Example #1
0
 protected void btnMoveDown_Click(object sender, EventArgs e)
 {
     GetHiddenValues();
     if (CategoryID > 0)
     {
         // Move category down
         SettingsCategoryInfoProvider.MoveCategoryDown(CategoryID);
         AfterAction("movedown", CategoryID, mTabIndex);
     }
 }
Example #2
0
    /// <summary>
    /// Handles the whole category actions.
    /// </summary>
    /// <param name="sender">Sender of event</param>
    /// <param name="e">Event arguments</param>
    protected void grpEdit_ActionPerformed(object sender, CommandEventArgs e)
    {
        int categoryId = ValidationHelper.GetInteger(e.CommandArgument, 0);

        switch (e.CommandName.ToLowerCSafe())
        {
        case ("edit"):
            // Redirect to category edit page
            SettingsCategoryInfo sci = SettingsCategoryInfo.Provider.Get(categoryId);
            if (sci != null)
            {
                URLHelper.Redirect(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(ModuleName.CMS, "Modules.Settings.EditCategory", false), "isgroup=1&categoryid=" + categoryId + "&moduleid=" + moduleId));
            }
            break;

        case ("delete"):
            try
            {
                SettingsCategoryInfo settingGroup = SettingsCategoryInfo.Provider.Get(categoryId);
                if (settingGroup != null)
                {
                    // Register refresh tree script
                    StringBuilder sb = new StringBuilder();
                    sb.Append("if (window.parent != null) {");
                    sb.Append("if (window.parent.parent.frames['settingstree'] != null) {");
                    sb.Append("window.parent.parent.frames['settingstree'].location = '" + ResolveUrl("~/CMSModules/Modules/Pages/Settings/Tree.aspx") + "?categoryid=" + settingGroup.CategoryParentID + "&moduleid=" + moduleId + "&reloadtreeselect=1';");
                    sb.Append("}");
                    sb.Append("if (window.parent.frames['settingstree'] != null) {");
                    sb.Append("window.parent.frames['settingstree'].location =  '" + ResolveUrl("~/CMSModules/Modules/Pages/Settings/Tree.aspx") + "?categoryid=" + settingGroup.CategoryParentID + "&moduleid=" + moduleId + "&reloadtreeselect=1';");
                    sb.Append("}");
                    sb.Append("}");

                    ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "treeGroupRefresh", ScriptHelper.GetScript(sb.ToString()));

                    SettingsCategoryInfo.Provider.Delete(settingGroup);
                }
            }
            catch
            {
                ShowError(GetString("settings.group.deleteerror"));
            }
            grpEdit.ReloadData();
            break;

        case ("moveup"):
            SettingsCategoryInfoProvider.MoveCategoryUp(categoryId);
            grpEdit.ReloadData();
            break;

        case ("movedown"):
            SettingsCategoryInfoProvider.MoveCategoryDown(categoryId);
            grpEdit.ReloadData();
            break;
        }
    }
Example #3
0
 protected void btnMoveDown_Click(object sender, EventArgs e)
 {
     GetHiddenValues();
     if (ElementID > 0)
     {
         SettingsCategoryInfoProvider.MoveCategoryDown(ElementID);
         if (AfterAction != null)
         {
             AfterAction("movedown", ElementID + "|" + mTabIndex);
         }
     }
 }
Example #4
0
    /// <summary>
    /// Handles the whole category actions.
    /// </summary>
    /// <param name="sender">Sender of event</param>
    /// <param name="e">Event arguments</param>
    protected void grpEdit_ActionPerformed(object sender, CommandEventArgs e)
    {
        int categoryId = ValidationHelper.GetInteger(e.CommandArgument, 0);

        switch (e.CommandName.ToLowerCSafe())
        {
        case ("edit"):
            SettingsCategoryInfo sci = SettingsCategoryInfoProvider.GetSettingsCategoryInfo(categoryId);
            if (sci != null)
            {
                URLHelper.Redirect("~/CMSModules/Settings/Development/CustomSettings/CustomSettingsCategory_Edit.aspx?treeroot=" + mTreeRoot + "&isgroup=1&categoryid=" + categoryId);
            }
            break;

        case ("delete"):
            try
            {
                SettingsCategoryInfo categoryObj = SettingsCategoryInfoProvider.GetSettingsCategoryInfo(categoryId);
                if (categoryObj.CategoryName != "CMS.CustomSettings")
                {
                    SettingsCategoryInfoProvider.DeleteSettingsCategoryInfo(categoryObj);
                }
            }
            catch
            {
                lblError.Text    = GetString("settings.group.deleteerror");
                lblError.Visible = true;
            }
            grpEdit.ReloadData();
            break;

        case ("moveup"):
            SettingsCategoryInfoProvider.MoveCategoryUp(categoryId);
            grpEdit.ReloadData();
            break;

        case ("movedown"):
            SettingsCategoryInfoProvider.MoveCategoryDown(categoryId);
            grpEdit.ReloadData();
            break;
        }
    }