Ejemplo n.º 1
0
    private void createPage(String tabName, List <TabPermissionInfo> permissions, bool visible, bool superTab, string parent)
    {
        PortalSettings portalSettings = new PortalSettings();
        int            portalId       = portalSettings.PortalId;
        TabController  TC             = new TabController();
        TabInfo        ti             = new TabInfo();

        ti.TabName  = tabName;
        ti.PortalID = portalId;
        ti.Title    = tabName;
        if (TC.GetTabByName(parent, portalId) != null)
        {
            ti.ParentId = TC.GetTabByName(parent, portalId).TabID;
        }
        ti.Description = tabName;
        ti.KeyWords    = tabName;
        ti.IsVisible   = visible;
        ti.DisableLink = false;
        ti.IsDeleted   = false;
        ti.Url         = "";
        ti.IsSuperTab  = superTab;
        foreach (TabPermissionInfo p in permissions)
        {
            ti.TabPermissions.Add(p);
        }
        TC.AddTab(ti);
    }
Ejemplo n.º 2
0
        public void MustHaveTestPageAdded()
        {
            //Create a tabInfo obj, then use TabController AddTab Method?
            TabInfo newPage = new TabInfo
            {
                TabName      = "Test Page",
                PortalID     = 0,
                SkinSrc      = "[G]Skins/DarkKnight/Home-Mega-Menu.ascx",
                ContainerSrc = "[G]Containers/DarkKnight/SubTitle_Grey.ascx"
            };
            TabController tabController = new TabController();
            var           tab           = tabController.GetTabByName("Test Page", 0);

            if (tab == null)
            {
                try
                {
                    tabController.AddTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Add Tab result: " + exc.Message);
                }
                //tabController.AddTab(newPage);
                newPage = tabController.GetTabByName("Test Page", 0);
                TabPermissionInfo tabPermission = new TabPermissionInfo();
                tabPermission.PermissionID = 3;
                tabPermission.TabID        = newPage.TabID;
                tabPermission.AllowAccess  = true;
                tabPermission.RoleID       = 0;
                newPage.TabPermissions.Add(tabPermission);
                try
                {
                    tabController.UpdateTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Update Tab result: " + exc.Message);
                }
                newPage = tabController.GetTabByName("Test Page", 0);
                tabPermission.RoleID       = 0;
                tabPermission.PermissionID = 4;
                tabPermission.TabID        = newPage.TabID;
                tabPermission.AllowAccess  = true;
                newPage.TabPermissions.Add(tabPermission);
                try
                {
                    tabController.UpdateTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message);
                }
            }
            else
            {
                tabController.RestoreTab(tab, PortalController.GetCurrentPortalSettings());
            }
            Config.Touch();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Upgrades the module.
        /// </summary>
        /// <param name="Version">The version.</param>
        /// <returns>System.String.</returns>
        public string UpgradeModule(string Version)
        {
            TabController tabs = new TabController();

            foreach (PortalInfo p in new PortalController().GetPortals())
            {
                TabInfo tabInfo = tabs.GetTabByName("Vanity Urls", p.PortalID);
                if (tabInfo == null)
                {
                    tabInfo          = new TabInfo();
                    tabInfo.TabID    = -1;
                    tabInfo.ParentId = tabs.GetTabByName("Admin", p.PortalID).TabID;
                    tabInfo.PortalID = p.PortalID;
                    tabInfo.TabName  = "Vanity Urls";
                    try
                    {
                        int tabId = tabs.AddTab(tabInfo);
                        AddModuleToPage(p.PortalID, tabId);
                        return("Vanity Urls page added");
                    }
                    catch (Exception ex)
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                }
            }

            return("");
        }
Ejemplo n.º 4
0
        public void MustHaveTestPageAdded()
        {
            //Create a tabInfo obj, then use TabController AddTab Method?
            TabInfo newPage = new TabInfo();

            newPage.TabName      = "Test Page";
            newPage.PortalID     = 0;
            newPage.SkinSrc      = "[G]Skins/Aphelia/twoColumn-rightAside.ascx";
            newPage.ContainerSrc = "[G]Containers/Aphelia/Title.ascx";
            TabController tabController = new TabController();
            var           tab           = tabController.GetTabByName("Test Page", 0);

            if (tab == null)
            {
                try
                {
                    tabController.AddTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Add Tab result: " + exc.Message);
                }
                //tabController.AddTab(newPage);
                newPage = tabController.GetTabByName("Test Page", 0);
                TabPermissionInfo tabPermission = new TabPermissionInfo();
                tabPermission.PermissionID = 3;
                tabPermission.TabID        = newPage.TabID;
                tabPermission.AllowAccess  = true;
                tabPermission.RoleID       = 0;
                newPage.TabPermissions.Add(tabPermission);
                try
                {
                    tabController.UpdateTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Update Tab result: " + exc.Message);
                }
                newPage = tabController.GetTabByName("Test Page", 0);
                tabPermission.RoleID       = 0;
                tabPermission.PermissionID = 4;
                tabPermission.TabID        = newPage.TabID;
                tabPermission.AllowAccess  = true;
                newPage.TabPermissions.Add(tabPermission);
                try
                {
                    tabController.UpdateTab(newPage);
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message);
                }
                Thread.Sleep(1500);
            }
        }
Ejemplo n.º 5
0
        private void ModuleAction_Click(object sender, ActionEventArgs e)
        {
            switch (e.Action.CommandName)
            {
            case "UpdateCategoriesTabs":
                using (SelectedHotelsEntities db = new SelectedHotelsEntities())
                {
                    var parentCategories =
                        db.MerchantCategories.Where(mc => mc.ParentId == null).OrderBy(mc => mc.Name);
                    TabController tabController = new TabController();
                    foreach (var parentCategory in parentCategories)
                    {
                        TabInfo tab = tabController.GetTabByName(parentCategory.Name, PortalId, -1);
                        if (tab == null)
                        {
                            tab = CreateTab(parentCategory.Name);
                            //Clear Cache
                            DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tab.TabID);
                            var childCategories =
                                db.MerchantCategories.Where(mc => mc.ParentId == parentCategory.Id)
                                .OrderBy(mc => mc.Name);
                            foreach (MerchantCategory merchantCategory in childCategories)
                            {
                                TabInfo childTab = tabController.GetTabByName(merchantCategory.Name, PortalId, tab.TabID);
                                if (childTab == null)
                                {
                                    childTab = CreateSubTab(merchantCategory.Name, merchantCategory.Id,
                                                            "merchantcategory", tab.TabID);
                                    //Clear Cache
                                    DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(childTab.TabID);
                                }
                            }
                        }
                    }

                    var portalTabs = tabController.GetTabsByPortal(PortalId);
                    foreach (KeyValuePair <int, TabInfo> pair in portalTabs)
                    {
                        if (!parentCategories.Any(pc => pc.Name == pair.Value.TabName && !pair.Value.TabPath.StartsWith("//Admin") && !pair.Value.TabPath.StartsWith("//Host")))
                        {
                            DeleteTab(pair.Value.TabName);
                        }
                    }
                }

                //Clear Cache
                DotNetNuke.Common.Utilities.DataCache.ClearTabsCache(PortalId);
                DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(PortalId, false);

                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Categories Tabs Updated", ModuleMessage.ModuleMessageType.GreenSuccess);
                break;
            }
        }
Ejemplo n.º 6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (UserInfo.IsSuperUser)
            {
                lnkEditLists.Text = Localization.GetString("lnkEditLists", LocalResourceFile);

                try {
                    var tabController = new TabController();
                    lnkEditLists.NavigateUrl = tabController.GetTabByName("Lists", Null.NullInteger).FullUrl;
                } catch {
                    // unable to locate "Lists" tab
                    lblCannotEditLists.Text    = Localization.GetString("UnableToFindLists", LocalResourceFile);
                    lblCannotEditLists.Visible = true;
                    lnkEditLists.Visible       = false;
                }
            }
            else
            {
                // show error, then hide the "Edit" link
                lblCannotEditLists.Text    = Localization.GetString("NoListAccess", LocalResourceFile);
                lblCannotEditLists.Visible = true;
                lnkEditLists.Visible       = false;
            }
        }
Ejemplo n.º 7
0
 protected void Page_Init(object sender, EventArgs e)
 {
     foreach (DataGridColumn column in grdPortals.Columns)
     {
         if (column.GetType() == typeof(ImageCommandColumn))
         {
             //Manage Delete Confirm JS
             ImageCommandColumn imageColumn = (ImageCommandColumn)column;
             if (imageColumn.CommandName == "Delete")
             {
                 imageColumn.OnClickJS = Localization.GetString("DeleteItem");
             }
             //Manage Edit Column NavigateURLFormatString
             if (imageColumn.CommandName == "Edit")
             {
                 //The Friendly URL parser does not like non-alphanumeric characters
                 //so first create the format string with a dummy value and then
                 //replace the dummy value with the FormatString place holder
                 TabController objTabs      = new TabController();
                 TabInfo       objTab       = objTabs.GetTabByName("Site Settings", PortalSettings.PortalId, PortalSettings.AdminTabId);
                 string        formatString = Globals.NavigateURL(objTab.TabID, "", "pid=KEYFIELD");
                 formatString = formatString.Replace("KEYFIELD", "{0}");
                 imageColumn.NavigateURLFormatString = formatString;
             }
             //Localize Image Column Text
             if (imageColumn.CommandName != "")
             {
                 imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile);
             }
         }
     }
 }
Ejemplo n.º 8
0
        public void AdvancedUrlProvider_ReplaceChars(Dictionary <string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("FriendlyUrl", testFields["TestName"]);

            string  testPageName = testFields.GetValue("TestPageName");
            TabInfo tab          = null;

            if (!String.IsNullOrEmpty(testPageName))
            {
                var tabName = testFields["Page Name"];
                var tc      = new TabController();
                tab         = tc.GetTabByName(tabName, PortalId);
                tab.TabName = testPageName;
                tc.UpdateTab(tab);

                //Refetch tab from DB
                tab = tc.GetTab(tab.TabID, tab.PortalID, false);
            }

            string autoAscii = testFields.GetValue("AutoAscii");

            if (!String.IsNullOrEmpty(autoAscii))
            {
                settings.AutoAsciiConvert = Convert.ToBoolean(autoAscii);
            }

            TestUtil.GetReplaceCharDictionary(testFields, settings.ReplaceCharacterDictionary);

            ExecuteTestForTab("Improved", tab, settings, testFields);
        }
Ejemplo n.º 9
0
        public void AdvancedUrlRewriter_SecureRedirect(Dictionary <string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);
            var isClient = Convert.ToBoolean(testFields["Client"]);

            _securePageName = testFields["Page Name"].Trim();

            PortalController.UpdatePortalSetting(PortalId, "SSLEnforced", testFields["Enforced"].Trim());
            PortalController.UpdatePortalSetting(PortalId, "SSLEnabled", testFields["Enabled"].Trim());

            var isSecure = Convert.ToBoolean(testFields["IsSecure"].Trim());

            if (isSecure)
            {
                var tc  = new TabController();
                var tab = tc.GetTabByName(_securePageName, PortalId);
                tab.IsSecure = true;

                UpdateTab(tab);
            }

            settings.SSLClientRedirect = isClient;

            ExecuteTest(settings, testFields, true);
        }
Ejemplo n.º 10
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var tc  = new TabController();
            var tab = tc.GetTabByName(_aboutUsPageName, PortalId);

            _tabId = tab.TabID;

            //Add Portal Aliases
            var aliasController = new PortalAliasController();

            TestUtil.ReadStream(String.Format("{0}", "Aliases"), (line, header) =>
            {
                string[] fields = line.Split(',');
                var alias       = aliasController.GetPortalAlias(fields[0], PortalId);
                if (alias == null)
                {
                    alias = new PortalAliasInfo
                    {
                        HTTPAlias = fields[0],
                        PortalID  = PortalId
                    };
                    TestablePortalAliasController.Instance.AddPortalAlias(alias);
                }
            });
            TestUtil.ReadStream(String.Format("{0}", "Users"), (line, header) =>
            {
                string[] fields = line.Split(',');

                TestUtil.AddUser(PortalId, fields[0].Trim(), fields[1].Trim(), fields[2].Trim());
            });
        }
Ejemplo n.º 11
0
        private void DeleteSubTab(string tabName, int parentId)
        {
            TabController tabController = new TabController();
            TabInfo       tab           = tabController.GetTabByName(tabName, PortalId, parentId);

            tabController.DeleteTab(tab.TabID, PortalId);
        }
Ejemplo n.º 12
0
    private void AddModuleToTab(TabInfo ti, DesktopModuleInfo dmi, string title = "", string paneName = "ContentPane", Dictionary <String, String> settings = null)
    {
        if (title == "")
        {
            title = dmi.ContentTitle;
        }
        PortalSettings    ps                = new PortalSettings();
        int               portalId          = ps.PortalId;
        DesktopModuleInfo desktopModuleInfo = null;

        foreach (KeyValuePair <int, DesktopModuleInfo> kvp in DesktopModuleController.GetDesktopModules(portalId))
        {
            DesktopModuleInfo mod = kvp.Value;
            if (mod != null)
            {
                if ((mod.FriendlyName == dmi.FriendlyName || mod.ModuleName == dmi.FriendlyName))
                {
                    desktopModuleInfo = mod;
                }
            }
        }

        if (desktopModuleInfo != null && ti != null)
        {
            foreach (ModuleDefinitionInfo moduleDefinitionInfo in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleInfo.DesktopModuleID).Values)
            {
                ModuleInfo moduleInfo = new ModuleInfo();
                moduleInfo.PortalID               = portalId;
                moduleInfo.TabID                  = ti.TabID;
                moduleInfo.ModuleOrder            = 1;
                moduleInfo.ModuleTitle            = title;
                moduleInfo.PaneName               = paneName;
                moduleInfo.ModuleDefID            = moduleDefinitionInfo.ModuleDefID;
                moduleInfo.CacheTime              = moduleDefinitionInfo.DefaultCacheTime;
                moduleInfo.InheritViewPermissions = true;
                moduleInfo.AllTabs                = false;
                ModuleController moduleController = new ModuleController();
                if (settings != null)
                {
                    foreach (KeyValuePair <String, String> kvp in settings)
                    {
                        if (kvp.Key.Contains("tabid"))
                        {
                            TabController tc = new TabController();
                            int           id = tc.GetTabByName(kvp.Value, portalId).TabID;
                            moduleInfo.ModuleSettings.Add(kvp.Key, id);
                            moduleController.UpdateModuleSetting(moduleInfo.ModuleID, kvp.Key, "" + id);
                        }
                        else
                        {
                            moduleInfo.ModuleSettings.Add(kvp.Key, kvp.Value);
                            moduleController.UpdateModuleSetting(moduleInfo.ModuleID, kvp.Key, kvp.Value);
                        }
                    }
                }
                int moduleId = moduleController.AddModule(moduleInfo);
            }
        }
    }
Ejemplo n.º 13
0
        private void UpdateTabSetting(string tabName, string settingName, string settingValue)
        {
            var tc  = new TabController();
            var tab = tc.GetTabByName(tabName, PortalId);

            tab.TabSettings[settingName] = settingValue;
            tc.UpdateTab(tab);
        }
Ejemplo n.º 14
0
        private void ExecuteTest(string test, FriendlyUrlSettings settings, Dictionary <string, string> testFields)
        {
            var tabName = testFields["Page Name"];
            var tc      = new TabController();
            var tab     = tc.GetTabByName(tabName, PortalId);

            ExecuteTestForTab(test, tab, settings, testFields);
        }
Ejemplo n.º 15
0
        public void GivenThereIsAPageCalled(string pageName, Table permissions)
        {
            var reset         = false;
            var tabController = new TabController();
            var tab           = tabController.GetTabByName(pageName, PortalId);

            if (tab == null)
            {
                tab = new TabInfo
                {
                    TabName  = pageName,
                    PortalID = 0
                };
                tab.TabID = tabController.AddTab(tab);
                foreach (var row in permissions.Rows)
                {
                    var roleId         = -1;
                    var roleController = new RoleController();
                    if (row[0] == "All Users")
                    {
                        roleId = -1;
                    }
                    else
                    {
                        var role = roleController.GetRoleByName(PortalId, row[0]);
                        if (role == null)
                        {
                            if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null)
                            {
                                role = new RoleInfo {
                                    RoleName = row[0], RoleGroupID = Null.NullInteger
                                };
                                roleId = roleController.AddRole(role);
                            }
                        }
                    }
                    var permissionController = new PermissionController();
                    var permission           = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]);
                    var tabPermission        = new TabPermissionInfo
                    {
                        PermissionID = 3,
                        TabID        = tab.TabID,
                        AllowAccess  = true,
                        RoleID       = roleId
                    };
                    tab.TabPermissions.Add(tabPermission);
                }

                tabController.UpdateTab(tab);
                reset = true;
            }
            Page = tab;
            if (reset)
            {
                Config.Touch();
            }
        }
Ejemplo n.º 16
0
        private void DeleteTab(string tabName, bool isSuperTab = true)
        {
            TabController tabController = new TabController();
            TabInfo       tab           = tabController.GetTabByName(tabName, PortalId);

            if (tab != null)
            {
                tabController.DeleteTab(tab.TabID, PortalId, true);
            }
        }
Ejemplo n.º 17
0
        private void MustNotHavePage(string pageName)
        {
            var     controller = new TabController();
            TabInfo page       = controller.GetTabByName(pageName, 0);

            if (page != null)
            {
                controller.DeleteTab(page.TabID, page.PortalID);
            }
        }
Ejemplo n.º 18
0
        private void DeleteTab(string tabName)
        {
            var tc  = new TabController();
            var tab = tc.GetTabByName(tabName, PortalId);

            if (tab != null)
            {
                tc.DeleteTab(tab.TabID, PortalId);
            }
        }
Ejemplo n.º 19
0
        public void PageDesignersMustNotExist()
        {
            var tabController = new TabController();
            var tab           = tabController.GetTabByName("Designers", 0);

            if (tab != null)
            {
                tabController.DeleteTab(tab.TabID, 0);
                Config.Touch();
            }
        }
Ejemplo n.º 20
0
    private bool createPage(String tabName, List <TabPermissionInfo> permissions, bool visible, bool superTab, string parent)
    {
        PortalSettings portalSettings = new PortalSettings();
        int            portalId       = portalSettings.PortalId;
        TabController  TC             = new TabController();
        TabInfo        ti             = new TabInfo();

        ti.TabName  = tabName;
        ti.PortalID = portalId;
        ti.Title    = "Courrier du District " + tabName;
        if (TC.GetTabByName(parent, portalId) != null)
        {
            ti.ParentId = TC.GetTabByName(parent, portalId).TabID;
        }
        ti.Description = tabName;
        ti.KeyWords    = tabName;
        ti.IsVisible   = visible;
        ti.DisableLink = false;
        ti.IsDeleted   = false;
        ti.Url         = "";
        ti.IsSuperTab  = superTab;
        foreach (TabPermissionInfo p in permissions)
        {
            ti.TabPermissions.Add(p);
        }
        try
        {
            TC.AddTab(ti);
        }
        catch (Exception ee)
        {
            if (TC != null && ti != null && ti.TabName != null && TC.GetTabByName(ti.TabName, portalId) != null && TC.GetTabByName(ti.TabName, portalId).IsDeleted)
            {
                lbl_pageExists.Visible = false;
                lbl_pageInBin.Visible  = true;
                hlk_pageExists.Visible = false;
            }
            return(false);
        }
        return(true);
    }
Ejemplo n.º 21
0
        protected string GetTabURL(string tabName, int portalId)
        {
            var tabController = new TabController();
            var tab           = tabController.GetTabByName(tabName, portalId);

            if (tab != null)
            {
                return(tab.FullUrl);
            }

            return(string.Empty);
        }
Ejemplo n.º 22
0
        protected string GetTabURL(string tabName, int portalId, int?parentId)
        {
            var tabController = new TabController();
            var tab           = parentId.HasValue ? tabController.GetTabByName(tabName, portalId, parentId.Value) : tabController.GetTabByName(tabName, portalId);

            if (tab != null)
            {
                return(tab.FullUrl);
            }

            return(string.Empty);
        }
Ejemplo n.º 23
0
        public static TabInfo AddHostPage(string tabName, string description, string tabIconFile,
                                          string tabIconFileLarge, bool isVisible)
        {
            var tabController = new TabController();
            var hostPage      = tabController.GetTabByName("Host", Null.NullInteger);

            if ((hostPage != null))
            {
                return(AddPage(hostPage, tabName, description, tabIconFile, tabIconFileLarge, isVisible,
                               new TabPermissionCollection(), true));
            }
            return(null);
        }
Ejemplo n.º 24
0
        private void ExecuteTest(FriendlyUrlSettings settings, Dictionary <string, string> testFields, bool setDefaultAlias)
        {
            var tabName = testFields["Page Name"];
            var tc      = new TabController();
            var tab     = tc.GetTabByName(tabName, PortalId);

            if (setDefaultAlias)
            {
                SetDefaultAlias(testFields);
            }

            ExecuteTestForTab(tab, settings, testFields);
        }
Ejemplo n.º 25
0
        public void AdvancedUrlRewriter_ForwardExternalUrls(Dictionary <string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            var tc  = new TabController();
            var tab = tc.GetTabByName(_testPage, PortalId);

            tab.Url = testFields["ExternalUrl"];
            tc.UpdateTab(tab);

            ExecuteTest(settings, testFields, true);
        }
        public ConsoleResultModel Run()
        {
            TabController    tc  = new TabController();
            List <PageModel> lst = new List <PageModel>();

            if (PageId.HasValue)
            {
                var tab = tc.GetTab((int)PageId, PortalId);
                if (tab != null)
                {
                    lst.Add(new PageModel(tab));
                }
            }
            else
            {
                TabInfo tab = null;
                if (ParentId.HasValue)
                {
                    tab = tc.GetTabByName(PageName, PortalId, (int)ParentId);
                }
                else
                {
                    tab = tc.GetTabByName(PageName, PortalId);
                }

                if (tab != null)
                {
                    lst.Add(new PageModel(tab));
                }
            }

            return(new ConsoleResultModel(string.Format("{0} page{1} found", lst.Count, (lst.Count != 1 ? "s" : "")))
            {
                data = lst
            });
        }
Ejemplo n.º 27
0
        private void GetHostTabs()
        {
            var tabController = new TabController();
            var hostTab       = TabController.GetTabByTabPath(Null.NullInteger, "//Host", string.Empty);
            var hosts         = TabController.GetTabsByParent(hostTab, -1);

            var            professionalTab = tabController.GetTabByName("Professional Features", -1);
            List <TabInfo> professionalTabs;

            if (professionalTab != null)
            {
                professionalTabs = TabController.GetTabsByParent(professionalTab.TabID, -1);
            }
            else
            {
                professionalTabs = new List <TabInfo>();
            }

            _hostTabs = new List <TabInfo>();
            _hostTabs.AddRange(hosts);
            _hostTabs.AddRange(professionalTabs);
            _hostTabs = _hostTabs.OrderBy(t => t.LocalizedTabName).ToList();

            _hostBaseTabs     = new List <TabInfo>();
            _hostAdvancedTabs = new List <TabInfo>();

            foreach (var tabInfo in _hostTabs)
            {
                switch (tabInfo.TabName)
                {
                case "Host Settings":
                case "Site Management":
                case "File Management":
                case "Extensions":
                case "Dashboard":
                case "Health Monitoring":
                case "Technical Support":
                case "Knowledge Base":
                case "Software and Documentation":
                    _hostBaseTabs.Add(tabInfo);
                    break;

                default:
                    _hostAdvancedTabs.Add(tabInfo);
                    break;
                }
            }
        }
Ejemplo n.º 28
0
        public void AdvancedUrlRewriter_DeletedTabHandling(Dictionary <string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            var tc  = new TabController();
            var tab = tc.GetTabByName(_testPage, PortalId);

            if (Convert.ToBoolean(testFields["HardDeleted"]))
            {
                DeleteTab(_testPage);
                CacheController.FlushPageIndexFromCache();
            }
            else
            {
                tab.IsDeleted   = Convert.ToBoolean(testFields["SoftDeleted"]);
                tab.DisableLink = Convert.ToBoolean(testFields["Disabled"]);
                if (Convert.ToBoolean(testFields["Expired"]))
                {
                    tab.EndDate = DateTime.Now - TimeSpan.FromDays(1);
                }
                UpdateTab(tab);
            }

            string deletedTabHandling = testFields.GetValue("DeletedTabHandling");

            if (!String.IsNullOrEmpty(deletedTabHandling))
            {
                switch (deletedTabHandling)
                {
                case "Do404Error":
                    settings.DeletedTabHandlingType = DeletedTabHandlingType.Do404Error;
                    break;

                default:
                    settings.DeletedTabHandlingType = DeletedTabHandlingType.Do301RedirectToPortalHome;
                    break;
                }
            }

            SetDefaultAlias(testFields);

            ExecuteTest(settings, testFields, true);
        }
Ejemplo n.º 29
0
        public TabInfo AddPluggPage(string tabName, string tabTitle)
        {
            PortalSettings portalSettings = new PortalSettings();
            int            portalId       = portalSettings.PortalId;

            TabController tabController = new TabController();
            TabInfo       getTab        = tabController.GetTabByName(tabName, portalId);

            if (getTab != null)
            {
                throw new Exception("Cannot create Page. Page with this PageName already exists");
            }

            TabInfo newTab = new TabInfo();

            newTab.PortalID     = portalId;
            newTab.TabName      = tabName;
            newTab.Title        = tabTitle;
            newTab.SkinSrc      = "[G]Skins/20047-UnlimitedColorPack-033/PluggPage.ascx";
            newTab.ContainerSrc = portalSettings.DefaultPortalContainer;
            CommonTabSettings(newTab);
            AddViewPermissions(newTab);

            int tabId = tabController.AddTab(newTab, true);

            DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId);

            AddTabURL(newTab); //Makes the URL of Page /4 or /C4

            // add modules to new page

            AddModuleToPage(newTab, ModuleType.DisplayPlugg);

            AddModuleToPage(newTab, ModuleType.CourseMenu);

            AddModuleToPage(newTab, ModuleType.Rating);

            AddModuleToPage(newTab, ModuleType.Comments);

            AddModuleToPage(newTab, ModuleType.DisplayPluggeTitle);

            return(newTab);
        }
Ejemplo n.º 30
0
        private void GetShowOnlyCurrent(TabController objTabController, ref int StartingItemId, ref int iRootGroupId)
        {
            StartingItemId = 0;
            iRootGroupId   = 0;
            //check if we have a value to work with
            if (string.IsNullOrEmpty(ShowOnlyCurrent))
            {
                return;
            }

            //check if user specified an ID
            if ((char.IsDigit(ShowOnlyCurrent.ToCharArray()[0])))
            {
                int output;
                if (int.TryParse(ShowOnlyCurrent, out output))
                {
                    StartingItemId = output;
                }
            }

            //check if user specified a page name
            if ((ShowOnlyCurrent.StartsWith("PageItem:")))
            {
                TabInfo temptab = objTabController.GetTabByName(ShowOnlyCurrent.Substring(("PageItem:").Length), PortalSettings.PortalId);
                if ((temptab != null))
                {
                    StartingItemId = temptab.TabID;
                }
            }

            //RootItem
            if (("RootItem" == ShowOnlyCurrent))
            {
                iRootGroupId = PortalSettings.ActiveTab.TabID;
                while (((objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId != -1))
                {
                    iRootGroupId = (objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId;
                }
            }
        }