コード例 #1
0
        /// <summary>
        /// Gets the DNN tab by URL and culture.
        /// </summary>
        /// <param name="pageUrl">The page URL.</param>
        /// <param name="culture">The culture.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        internal static TabInfo GetDnnTabByUrl(string pageUrl, string culture)
        {
            var           alternativeLocale = LocaleController.Instance.GetLocale(culture);
            TabController tc             = new TabController();
            var           alternativeTab = tc.GetTabByCulture(PortalSettings.Current.ActiveTab.TabID, PortalSettings.Current.PortalId, alternativeLocale);

            throw new NotImplementedException();
        }
コード例 #2
0
        private List <ModuleInfo> GetChildModules(int tabId, string cultureCode)
        {
            var    modules = new List <ModuleInfo>();
            var    tabCtrl = new TabController();
            Locale locale  = LocaleController.Instance.GetLocale(cultureCode);

            if (locale != null)
            {
                modules = (from kvp in tabCtrl.GetTabByCulture(tabId, PortalSettings.PortalId, locale).ChildModules where !kvp.Value.IsDeleted select kvp.Value).ToList();
            }
            return(modules);
        }
コード例 #3
0
        ///// <summary>
        ///// Gets the DNN tab by URL and culture.
        ///// </summary>
        ///// <param name="pageUrl">The page URL.</param>
        ///// <param name="culture">The culture.</param>
        ///// <returns></returns>
        ///// <exception cref="System.NotImplementedException"></exception>
        //internal static TabInfo GetDnnTabByUrl(string pageUrl, string culture)
        //{
        //    var alternativeLocale = LocaleController.Instance.GetLocale(culture);
        //    TabController tc = new TabController();
        //    var alternativeTab = tc.GetTabByCulture(PortalSettings.Current.ActiveTab.TabID, PortalSettings.Current.PortalId, alternativeLocale);
        //    throw new NotImplementedException();
        //}

        public static int GetTabByCurrentCulture(int portalId, int tabId, string cultureCode)
        {
            var    tc     = new TabController();
            Locale locale = LocaleController.Instance.GetLocale(cultureCode);
            var    tab    = tc.GetTabByCulture(tabId, portalId, locale);

            if (tab != null)
            {
                return(tab.TabID);
            }
            else
            {
                return(tabId);
            }
        }
コード例 #4
0
ファイル: RecycleBin.ascx.cs プロジェクト: ds-rod/dnnIJT
        private void BindData(bool refresh)
        {
            if (refresh)
            {
                LoadData();
            }

            var tabController = new TabController();

            modulesListBox.Items.Clear();
            tabsListBox.Items.Clear();

            foreach (ModuleInfo module in DeletedModules)
            {
                if (String.IsNullOrEmpty(module.ModuleTitle))
                {
                    module.ModuleTitle = module.DesktopModule.FriendlyName;
                }

                var locale = LocaleController.Instance.GetLocale(module.CultureCode);

                TabInfo tab = locale != null
                                ? tabController.GetTabByCulture(module.TabID, PortalId, locale)
                                : tabController.GetTab(module.TabID, PortalId, false);

                if (tab == null)
                {
                    modulesListBox.Items.Add(new ListItem(module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
                }
                else if (tab.TabID == module.TabID)
                {
                    modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
                }
            }

            foreach (var tab in DeletedTabs)
            {
                var item = new ListItem(tab.IndentedTabName + " - " + tab.LastModifiedOnDate, tab.TabID.ToString());
                item.Attributes.Add("ParentId", tab.ParentId.ToString());
                tabsListBox.Items.Add(item);
            }

            cmdRestoreTab.Enabled    = (DeletedTabs.Count > 0);
            cmdDeleteTab.Enabled     = (DeletedTabs.Count > 0);
            cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
            cmdDeleteModule.Enabled  = (modulesListBox.Items.Count > 0);
            cmdEmpty.Enabled         = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
        }
コード例 #5
0
        private string ResolvePageLink(int id, string defaultValue)
        {
            var tabController = new TabController();
            // 2016-03-03 before issue #710
            //var tabInfo = tabController.GetTab(linkId);
            //if (tabInfo == null)
            //    return defaultValue;

            //return tabInfo.TabPath;
            //ownerPortalSettings = SxcInstance.
            var tabInfo = tabController.GetTab(id);

            if (tabInfo == null)
            {
                return(defaultValue);
            }

            var portalSettings = PortalSettings.Current;

            // Get full PortalSettings (with portal alias) if module sharing is active
            if (PortalSettings.Current != null && PortalSettings.Current.PortalId != tabInfo.PortalID)
            {
                //{
                portalSettings = new PortalSettings(tabInfo.PortalID);
            }
            //var portalAlias = ownerPortalSettings.PrimaryAlias ?? TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(tabInfo.PortalID).First();
            //portalSettings = new PortalSettings(id, portalAlias);
            //}
            if (portalSettings == null)
            {
                return(defaultValue);
            }

            // var tabInfo = tabController.GetTab(id, portalSettings.PortalId, false);
            // if (tabInfo == null) return defaultValue;
            if (tabInfo.CultureCode != "" && tabInfo.CultureCode != PortalSettings.Current.CultureCode)
            {
                var cultureTabInfo = tabController.GetTabByCulture(tabInfo.TabID, tabInfo.PortalID, LocaleController.Instance.GetLocale(PortalSettings.Current.CultureCode));

                if (cultureTabInfo != null)
                {
                    tabInfo = cultureTabInfo;
                }
            }

            // Exception in AdvancedURLProvider because ownerPortalSettings.PortalAlias is null
            return(Globals.NavigateURL(tabInfo.TabID, portalSettings, "", new string[] {}));// + urlParams;
        }
コード例 #6
0
        private void BindData(bool refresh)
        {
            if (refresh)
            {
                LoadData();
            }

            var tabController = new TabController();

            modulesListBox.Items.Clear();
            tabsListBox.Items.Clear();

            foreach (ModuleInfo module in DeletedModules)
            {
                if (String.IsNullOrEmpty(module.ModuleTitle))
                {
                    module.ModuleTitle = module.DesktopModule.FriendlyName;
                }

                var locale = LocaleController.Instance.GetLocale(module.CultureCode);

                TabInfo tab = locale != null
                                ? tabController.GetTabByCulture(module.TabID, PortalId, locale)
                                : tabController.GetTab(module.TabID, PortalId, false);

                if (tab == null)
                {
                    modulesListBox.Items.Add(new ListItem(module.ModuleTitle, module.TabID + "-" + module.ModuleID));
                }
                else if (tab.TabID == module.TabID)
                {
                    modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle, module.TabID + "-" + module.ModuleID));
                }
            }

            tabsListBox.DataSource = DeletedTabs;
            tabsListBox.DataBind();

            cmdRestoreTab.Enabled = (DeletedTabs.Count > 0);
            cmdDeleteTab.Enabled  = (DeletedTabs.Count > 0);

            cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
            cmdDeleteModule.Enabled  = (modulesListBox.Items.Count > 0);

            cmdEmpty.Enabled = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
        }
コード例 #7
0
        /// <summary>
        /// Finds a culture-specific homepage tabid for a non-default language
        /// </summary>
        /// <param name="defaultCulture">The default culture of the portal</param>
        /// <param name="cultureCode"></param>
        /// <param name="defaultHomeTabId">The default home page tab id</param>
        /// <param name="portalId"></param>
        /// <returns>THe valid home page tabid for the portalid and culture</returns>
        /// <remarks>Note if no specific home page found for the culture, will return defaultHomeTabId back</remarks>
        internal static int GetHomePageTabIdForCulture(string defaultCulture, int portalId, string cultureCode,
                                                       int defaultHomeTabId)
        {
            int homeTabId = defaultHomeTabId;

            if (String.Compare(defaultCulture, cultureCode, StringComparison.OrdinalIgnoreCase) != 0)
            {
                //not the default culture, so there could be a different home page for the different cultulre in 5.5+ builds
                var tc            = new TabController();
                var cultureLocale = new Locale {
                    Code = cultureCode, Fallback = cultureCode, Text = cultureCode
                };
                TabInfo tab = tc.GetTabByCulture(defaultHomeTabId, portalId, cultureLocale);
                if (tab != null)
                {
                    //this is the culture specific tab of the home page
                    homeTabId = tab.TabID;
                }
            }
            return(homeTabId);
        }
コード例 #8
0
        private static string ResolvePageLink(int id)
        {
            var tabController = new TabController();

            var tabInfo = tabController.GetTab(id, 0);

            if (tabInfo == null)
            {
                return(null);
            }

            var portalSettings = PortalSettings.Current;

            // Get full PortalSettings (with portal alias) if module sharing is active
            if (PortalSettings.Current != null && PortalSettings.Current.PortalId != tabInfo.PortalID)
            {
                portalSettings = new PortalSettings(tabInfo.PortalID);
            }

            if (portalSettings == null)
            {
                return(null);
            }

            if (tabInfo.CultureCode != "" && PortalSettings.Current != null && tabInfo.CultureCode != PortalSettings.Current.CultureCode)
            {
                var cultureTabInfo = tabController
                                     .GetTabByCulture(tabInfo.TabID, tabInfo.PortalID,
                                                      LocaleController.Instance.GetLocale(PortalSettings.Current.CultureCode));

                if (cultureTabInfo != null)
                {
                    tabInfo = cultureTabInfo;
                }
            }

            // Exception in AdvancedURLProvider because ownerPortalSettings.PortalAlias is null
            return(Globals.NavigateURL(tabInfo.TabID, portalSettings, "", new string[] { }));
        }
コード例 #9
0
        /// <summary>
        /// Loads deleted tabs and modules into the lists
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [VMasanas]	18/08/2004
        ///   [VMasanas]  20/08/2004  Update display information for deleted modules to:
        ///               ModuleFriendlyName: ModuleTitle - Tab: TabName
        /// </history>
        private void BindData()
        {
            var        objModules = new ModuleController();
            var        objTabs    = new TabController();
            TabInfo    objTab;
            ModuleInfo objModule;
            int        intModule;

            lstModules.Items.Clear();
            lstTabs.Items.Clear();

            var currentLocale = LocaleController.Instance.GetCurrentLocale(PortalId);

            var           arrDeletedTabs = new ArrayList();
            TabCollection tabsList;

            if (modeButtonList.SelectedValue == "ALL")
            {
                tabsList = objTabs.GetTabsByPortal(PortalId);
            }
            else
            {
                tabsList = objTabs.GetTabsByPortal(PortalId).WithCulture(currentLocale.Code, true);
            }

            foreach (var tab in tabsList.Values)
            {
                if (tab.IsDeleted)
                {
                    arrDeletedTabs.Add(tab);
                }
            }

            var arrModules = objModules.GetModules(PortalId);

            for (intModule = 0; intModule <= arrModules.Count - 1; intModule++)
            {
                objModule = (ModuleInfo)arrModules[intModule];
                if (objModule.IsDeleted && (modeButtonList.SelectedValue == "ALL" || objModule.CultureCode == currentLocale.Code))
                {
                    if (String.IsNullOrEmpty(objModule.ModuleTitle))
                    {
                        objModule.ModuleTitle = objModule.DesktopModule.FriendlyName;
                    }
                    var locale = LocaleController.Instance.GetLocale(objModule.CultureCode);
                    if (locale != null)
                    {
                        objTab = objTabs.GetTabByCulture(objModule.TabID, PortalId, locale);
                    }
                    else
                    {
                        objTab = objTabs.GetTab(objModule.TabID, PortalId, false);
                    }

                    if (objTab == null)
                    {
                        lstModules.Items.Add(new ListItem(objModule.ModuleTitle, objModule.TabID + "-" + objModule.ModuleID));
                    }
                    else if (objTab.TabID == objModule.TabID)
                    {
                        lstModules.Items.Add(new ListItem(objTab.TabName + " - " + objModule.ModuleTitle, objModule.TabID + "-" + objModule.ModuleID));
                    }
                }
            }
            lstTabs.DataSource = arrDeletedTabs;
            lstTabs.DataBind();

            cmdRestoreTab.Enabled = (arrDeletedTabs.Count > 0);
            cmdDeleteTab.Enabled  = (arrDeletedTabs.Count > 0);

            cmdRestoreModule.Enabled = (lstModules.Items.Count > 0);
            cmdDeleteModule.Enabled  = (lstModules.Items.Count > 0);

            cmdEmpty.Enabled = arrDeletedTabs.Count > 0 || lstModules.Items.Count > 0;
        }