Beispiel #1
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Initialize resource strings
        rqfWordExpression.ErrorMessage = GetString("general.requiresvalue");

        if (badWordId > 0)
        {
            badWordObj = BadWordInfoProvider.GetBadWordInfo(badWordId);

            // Set edited object
            EditedObject = badWordObj;

            if (badWordObj != null)
            {
                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(badWordObj);

                    // Show that the badWord was created or updated successfully
                    if (QueryHelper.GetString("saved", string.Empty) == "1")
                    {
                        ShowChangesSaved();
                    }
                }
                else
                {
                    // Set selected action
                    SetSelectedAction(badWordObj);
                }
            }
        }
        else
        {
            PageTitle.TitleText = GetString("BadWords_Edit.NewItemCaption");
            // Initialize breadcrumbs
            List <BreadcrumbItem> breadCrumbItems = new List <BreadcrumbItem>();
            breadCrumbItems.Add(new BreadcrumbItem
            {
                Text        = GetString("badwords_edit.itemlistlink"),
                RedirectUrl = "~/CMSModules/BadWords/BadWords_List.aspx",
                Target      = "_self",
            });
            breadCrumbItems.Add(new BreadcrumbItem
            {
                Text = GetString("badwords_list.newitemcaption"),
            });
            PageBreadcrumbs.Items = breadCrumbItems;
            SetSelectedAction(null);
        }

        // Enable / disable actions (depending on inheritance)
        SelectBadWordActionControl.Enabled = !chkInheritAction.Checked;
        txtWordReplacement.Enabled         = !chkInheritReplacement.Checked;

        // Show / hide replacement textbox depending on action
        plcReplacement.Visible = ((BadWordActionEnum)Enum.Parse(typeof(BadWordActionEnum), SelectBadWordActionControl.Value.ToString())) == BadWordActionEnum.Replace;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int  badWordId         = QueryHelper.GetInteger("badWordId", 0);
        bool badWordIsSelected = (badWordId != 0);

        // Initialize PageTitle breadcrumbs
        string[,] pageTitleTabs = new string[2, 3];
        pageTitleTabs[0, 0]     = GetString("badwords_edit.itemlistlink");
        pageTitleTabs[0, 1]     = "~/CMSModules/BadWords/BadWords_List.aspx";
        pageTitleTabs[0, 2]     = "_parent";
        string badWord = string.Empty;

        // Get bad word name
        if (!badWordIsSelected)
        {
            badWord = GetString("badwords_list.newitemcaption");
        }
        else
        {
            BadWordInfo badWordInfo = BadWordInfoProvider.GetBadWordInfo(badWordId);
            if (badWordInfo != null)
            {
                badWord = badWordInfo.WordExpression;
            }
        }
        pageTitleTabs[1, 0] = badWord;
        pageTitleTabs[1, 1] = string.Empty;
        pageTitleTabs[1, 2] = string.Empty;

        // Initialize masterpage properties
        CurrentMaster.Title.Breadcrumbs = pageTitleTabs;
        CurrentMaster.Title.TitleText   = !badWordIsSelected?GetString("BadWords_List.HeaderCaption") : GetString("BadWords_Edit.badwordproperties");

        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/Badwords_Word/object.png");
        CurrentMaster.Title.HelpTopicName = "general_badwords";
        CurrentMaster.Title.HelpName      = "helpTopic";

        if (!RequestHelper.IsPostBack())
        {
            InitalizeMenu();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get ID of bad word
        badWordId = QueryHelper.GetInteger("badwordid", 0);

        if (badWordId > 0)
        {
            radAll.CheckedChanged      += isGlobal_CheckedChanged;
            radSelected.CheckedChanged += isGlobal_CheckedChanged;
            badWordObj = BadWordInfoProvider.GetBadWordInfo(badWordId);
            // Set edited object
            EditedObject = badWordObj;

            if (badWordObj != null)
            {
                if (!RequestHelper.IsPostBack())
                {
                    // Initialize radiobuttons
                    radAll.Checked      = badWordObj.WordIsGlobal;
                    radSelected.Checked = !badWordObj.WordIsGlobal;
                }
            }

            // Show / hide selector
            SetSelectorVisibility();

            // Get the word cultures
            if (!RequestHelper.IsPostBack() || (radSelected == ControlsHelper.GetPostBackControl(Page)))
            {
                usWordCultures.Value = GetCurrentValues();
            }
        }

        // Initialize selector properties
        usWordCultures.OnSelectionChanged           += usWordCultures_OnSelectionChanged;
        usWordCultures.ButtonRemoveSelected.CssClass = "XLongButton";
        usWordCultures.ButtonAddItems.CssClass       = "XLongButton";
    }
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Initialize resource strings
        rqfWordExpression.ErrorMessage = GetString("general.requiresvalue");

        if (badWordId > 0)
        {
            badWordObj = BadWordInfoProvider.GetBadWordInfo(badWordId);
            // Set edited object
            EditedObject = badWordObj;

            if (badWordObj != null)
            {
                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(badWordObj);

                    // Show that the badWord was created or updated successfully
                    if (QueryHelper.GetString("saved", string.Empty) == "1")
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("General.ChangesSaved");
                        // Refresh header
                        ScriptHelper.RegisterClientScriptBlock(this, GetType(), "refreshBadwordsHeader", ScriptHelper.GetScript("parent.frames['badwordsMenu'].location = 'BadWords_Edit_Header.aspx?badwordid=" + badWordObj.WordID + "';"));
                    }
                }
                else
                {
                    // Set selected action
                    SetSelectedAction(badWordObj);
                }
            }
        }
        else
        {
            CurrentMaster.Title.TitleText     = GetString("BadWords_Edit.NewItemCaption");
            CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/Badwords_Word/new.png");
            CurrentMaster.Title.HelpTopicName = "general_badwords";
            CurrentMaster.Title.HelpName      = "helpTopic";

            // Initialize breadcrumbs
            string[,] pageTitleTabs         = new string[2, 3];
            pageTitleTabs[0, 0]             = GetString("badwords_edit.itemlistlink");
            pageTitleTabs[0, 1]             = "~/CMSModules/BadWords/BadWords_List.aspx";
            pageTitleTabs[0, 2]             = "_self";
            pageTitleTabs[1, 0]             = GetString("badwords_list.newitemcaption");
            pageTitleTabs[1, 1]             = "";
            pageTitleTabs[1, 2]             = "";
            CurrentMaster.Title.Breadcrumbs = pageTitleTabs;
            SetSelectedAction(null);
        }

        // Enable / disable actions (depending on inheritance)
        SelectBadWordActionControl.Enabled = !chkInheritAction.Checked;
        txtWordReplacement.Enabled         = !chkInheritReplacement.Checked;

        // Show / hide replacement textbox depending on action
        plcReplacement.Visible = ((BadWordActionEnum)Enum.Parse(typeof(BadWordActionEnum), SelectBadWordActionControl.Value.ToString())) == BadWordActionEnum.Replace;
    }