当前位置: 首页>>代码示例>>C#>>正文


C# TabController.SoftDeleteTab方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.SoftDeleteTab方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.SoftDeleteTab方法的具体用法?C# TabController.SoftDeleteTab怎么用?C# TabController.SoftDeleteTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Tabs.TabController的用法示例。


在下文中一共展示了TabController.SoftDeleteTab方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteTab

        private bool DeleteTab(int deleteTabId)
        {
            var bDeleted = Null.NullBoolean;
            if (TabPermissionController.CanDeletePage())
            {
                var tabController = new TabController();
                bDeleted = tabController.SoftDeleteTab(deleteTabId, PortalSettings);
                if (!bDeleted)
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DeleteSpecialPage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DeletePermissionError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
            }

            return bDeleted;
        }
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:19,代码来源:ManageTabs.ascx.cs

示例2: CtlPagesContextMenuItemClick

        protected void CtlPagesContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        {
            SelectedNode = e.Node.Value;

            var tabController = new TabController();
            var portalId = rblMode.SelectedValue == "H" ? Null.NullInteger : PortalId;
            var objTab = tabController.GetTab(int.Parse(e.Node.Value), portalId, false);

            switch (e.MenuItem.Value.ToLower())
            {
                case "makehome":
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))
                    {
                        var portalController = new PortalController();
                        PortalInfo portalInfo = portalController.GetPortal(PortalId);
                        portalInfo.HomeTabId = objTab.TabID;
                        PortalSettings.HomeTabId = objTab.TabID;
                        portalController.UpdatePortalInfo(portalInfo);
                        DataCache.ClearPortalCache(PortalId, false);
                        BindTreeAndShowTab(objTab.TabID);
                        ShowSuccessMessage(string.Format(Localization.GetString("TabMadeHome", LocalResourceFile), objTab.TabName));
                    }
                    break;
                case "view":
                    Response.Redirect(objTab.FullUrl);
                    break;
                case "edit":
                    if (TabPermissionController.CanManagePage(objTab))
                    {
                        var editUrl = Globals.NavigateURL(objTab.TabID, "Tab", "action=edit", "returntabid=" + TabId);
                        // Prevent PageSettings of the current page in a popup if SSL is enabled and enforced, which causes redirection/javascript broswer security issues.
                        if (PortalSettings.EnablePopUps && !(objTab.TabID == TabId && (PortalSettings.SSLEnabled && PortalSettings.SSLEnforced)))
                        {
                            editUrl = UrlUtils.PopUpUrl(editUrl, this, PortalSettings, true, false);
                            var script = string.Format("<script type=\"text/javascript\">{0}</script>", editUrl);
                            ClientAPI.RegisterStartUpScript(Page, "EditInPopup", script);
                        }
                        else
                        {
                            Response.Redirect(editUrl, true);
                        }
                    }
                    break;
                case "delete":
                    if (TabPermissionController.CanDeletePage(objTab))
                    {
                        tabController.SoftDeleteTab(objTab.TabID, PortalSettings);
                        BindTree();
                        //keep the parent tab selected
                        if (objTab.ParentId != Null.NullInteger)
                        {
                            SelectedNode = objTab.ParentId.ToString(CultureInfo.InvariantCulture);
                            ctlPages.FindNodeByValue(SelectedNode).Selected = true;
                            ctlPages.FindNodeByValue(SelectedNode).ExpandParentNodes();
                            BindTab(objTab.ParentId);
                        }
                        else
                        {
                            pnlDetails.Visible = false;
                        }
                        ShowSuccessMessage(string.Format(Localization.GetString("TabDeleted", LocalResourceFile), objTab.TabName));
                    }
                    break;
                case "add":
                    if ((objTab!= null && TabPermissionController.CanAddPage(objTab)) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName)))
                    {
                        pnlBulk.Visible = true;
                        btnBulkCreate.CommandArgument = e.Node.Value;
                        ctlPages.FindNodeByValue(e.Node.Value).Selected = true;
                        txtBulk.Focus();
                        pnlDetails.Visible = false;
                        //Response.Redirect(NavigateURL(objTab.TabID, "Tab", "action=add", "returntabid=" & TabId.ToString), True)
                    }
                    break;
                case "hide":
                    if (TabPermissionController.CanManagePage(objTab))
                    {
                        objTab.IsVisible = false;
                        tabController.UpdateTab(objTab);
                        BindTreeAndShowTab(objTab.TabID);
                        ShowSuccessMessage(string.Format(Localization.GetString("TabHidden", LocalResourceFile), objTab.TabName));
                    }
                    break;
                case "show":
                    if (TabPermissionController.CanManagePage(objTab))
                    {
                        objTab.IsVisible = true;
                        tabController.UpdateTab(objTab);
                        BindTreeAndShowTab(objTab.TabID);
                        ShowSuccessMessage(string.Format(Localization.GetString("TabShown", LocalResourceFile), objTab.TabName));
                    }
                    break;
                case "disable":
                    if (TabPermissionController.CanManagePage(objTab))
                    {
                        objTab.DisableLink = true;
                        tabController.UpdateTab(objTab);
                        BindTreeAndShowTab(objTab.TabID);
                        ShowSuccessMessage(string.Format(Localization.GetString("TabDisabled", LocalResourceFile), objTab.TabName));
                    }
//.........这里部分代码省略.........
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:101,代码来源:Tabs.ascx.cs

示例3: enabledCheckbox_CheckChanged

        protected void enabledCheckbox_CheckChanged(object sender, EventArgs e)
        {
            try
            {
                if ((sender) is DnnCheckBox)
                {
                    var enabledCheckbox = (DnnCheckBox) sender;
                    int languageId = int.Parse(enabledCheckbox.CommandArgument);
                    Locale locale = LocaleController.Instance.GetLocale(languageId);
                    Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId);

                    Dictionary<string, Locale> enabledLanguages = LocaleController.Instance.GetLocales(PortalId);

                    var tabController = new TabController();
                    var localizedTabs = PortalSettings.ContentLocalizationEnabled ?
                        tabController.GetTabsByPortal(PortalId).WithCulture(locale.Code, false).AsList() : new List<TabInfo>();

                    var redirectUrl = string.Empty;
                    if (enabledCheckbox.Enabled)
                    {
                        // do not touch default language
                        if (enabledCheckbox.Checked)
                        {
                            if (!enabledLanguages.ContainsKey(locale.Code))
                            {
                                //Add language to portal
                                Localization.AddLanguageToPortal(PortalId, languageId, true);
                            }

                            //restore the tabs and modules
                            var moduleController = new ModuleController();
                            foreach (var tab in localizedTabs)
                            {
                                tabController.RestoreTab(tab, PortalSettings);
                                moduleController.GetTabModules(tab.TabID).Values.ToList().ForEach(moduleController.RestoreModule);
                            }
                        }
                        else
                        {
                            //remove language from portal
                            Localization.RemoveLanguageFromPortal(PortalId, languageId);

                            //if the disable language is current language, should redirect to default language.
                            if(locale.Code.Equals(Thread.CurrentThread.CurrentUICulture.ToString(), StringComparison.InvariantCultureIgnoreCase))
                            {
                                redirectUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID,
                                                                    PortalSettings.ActiveTab.IsSuperTab,
                                                                    PortalSettings, "", defaultLocale.Code);
                            }

                            //delete the tabs in this language
                            foreach (var tab in localizedTabs)
                            {
                                tab.DefaultLanguageGuid = Guid.Empty;
                                tabController.SoftDeleteTab(tab.TabID, PortalSettings);
                            }
                        }
                    }

                    //Redirect to refresh page (and skinobjects)
                    if (string.IsNullOrEmpty(redirectUrl))
                    {
                        redirectUrl = Globals.NavigateURL();
                    }

                    Response.Redirect(redirectUrl, true);
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:73,代码来源:LanguageEnabler.ascx.cs


注:本文中的DotNetNuke.Entities.Tabs.TabController.SoftDeleteTab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。