コード例 #1
0
        public static TabInfo MessagingPage(string ModuleFriendlyName)
        {
            if (((_MessagingPage != null)))
                return _MessagingPage;

            ModuleController mc = new ModuleController();
            ModuleInfo md = mc.GetModuleByDefinition(PortalSettings.Current.PortalId, ModuleFriendlyName);
            if ((md != null))
            {
                ArrayList a = mc.GetModuleTabs(md.ModuleID);
                if ((a != null))
                {
                    ModuleInfo mi = a[0] as ModuleInfo;
                    if ((mi != null))
                    {
                        TabController tc = new TabController();
                        _MessagingPage = tc.GetTab(mi.TabID, PortalSettings.Current.PortalId, false);
                    }
                }
            }

            return _MessagingPage;

        }
コード例 #2
0
        /// <summary>
        /// Return the sitemap url node for the page
        /// </summary>
        /// <param name="objTab">The page being indexed</param>
        /// <returns>A SitemapUrl object for the current page</returns>
        /// <remarks></remarks>

        private SitemapUrl GetPageUrl(TabInfo objTab, string language)
        {
            SitemapUrl pageUrl = new SitemapUrl();
            pageUrl.Url = CommonLibrary.Common.Globals.NavigateURL(objTab.TabID, objTab.IsSuperTab, ps, "", language);

            if (pageUrl.Url.ToLower().IndexOf(ps.PortalAlias.HTTPAlias.ToLower()) == -1)
            {
                // code to fix a bug in dnn5.1.2 for navigateurl
                if ((HttpContext.Current != null))
                {
                    pageUrl.Url = Globals.AddHTTP(HttpContext.Current.Request.Url.Host + pageUrl.Url);
                }
                else
                {
                    // try to use the portalalias
                    pageUrl.Url = Globals.AddHTTP(ps.PortalAlias.HTTPAlias.ToLower()) + pageUrl.Url;
                }
            }
            pageUrl.Priority = GetPriority(objTab);
            pageUrl.LastModified = DateTime.Now;
            pageUrl.ChangeFrequency = SitemapChangeFrequency.Daily;

            return pageUrl;
        }
コード例 #3
0
 public abstract string FriendlyUrl(TabInfo tab, string path, string pageName, PortalSettings settings);
コード例 #4
0
 private static void AddNode(TabInfo objTab, NodeCollection objNodes, Hashtable objBreadCrumbs, PortalSettings objPortalSettings, ToolTipSource eToolTips)
 {
     Node objNode = new Node();
     if (objTab.Title == "~")
     {
         objNodes.AddBreak();
     }
     else
     {
         if (objBreadCrumbs.Contains(objTab.TabID))
         {
             objNode.BreadCrumb = true;
             if (objTab.TabID == objPortalSettings.ActiveTab.TabID)
             {
                 objNode.Selected = true;
             }
         }
         if (objTab.DisableLink)
             objNode.Enabled = false;
         objNode.ID = objTab.TabID.ToString();
         objNode.Key = objNode.ID;
         objNode.Text = objTab.LocalizedTabName;
         objNode.NavigateURL = objTab.FullUrl;
         objNode.ClickAction = eClickAction.Navigate;
         objNode.Image = objTab.IconFile;
         switch (eToolTips)
         {
             case ToolTipSource.TabName:
                 objNode.ToolTip = objTab.LocalizedTabName;
                 break;
             case ToolTipSource.Title:
                 objNode.ToolTip = objTab.Title;
                 break;
             case ToolTipSource.Description:
                 objNode.ToolTip = objTab.Description;
                 break;
         }
         objNodes.Add(objNode);
     }
 }
コード例 #5
0
 private void AddTabToEndOfList(TabInfo objTab, bool updateTabPath)
 {
     List<TabInfo> siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId);
     TabInfo parentTab = GetTab(objTab.ParentId, objTab.PortalID, false);
     if (parentTab == null)
     {
         objTab.Level = 0;
     }
     else
     {
         objTab.Level = parentTab.Level + 1;
     }
     UpdateTabOrder(siblingTabs, 2);
     objTab.TabOrder = 2 * siblingTabs.Count + 1;
     UpdateTabOrder(objTab, updateTabPath);
 }
コード例 #6
0
 private static bool IsTabPending(TabInfo objTab, Node objParentNode, Node objRootNode, int intDepth, Hashtable objBreadCrumbs, int intLastBreadCrumbId, bool blnPOD)
 {
     if (intDepth == -1)
         return false;
     if (objParentNode.Level + 1 - objRootNode.Level <= intDepth)
         return false;
     if (blnPOD)
     {
         if (objBreadCrumbs.Contains(objTab.TabID))
             return false;
         if (objBreadCrumbs.Contains(objTab.ParentId) && intLastBreadCrumbId != objTab.ParentId)
             return false;
     }
     return true;
 }
コード例 #7
0
 private static void ProcessTab(Node objRootNode, TabInfo objTab, Hashtable objTabLookup, Hashtable objBreadCrumbs, int intLastBreadCrumbId, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions)
 {
     PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
     NodeCollection objRootNodes = objRootNode.Nodes;
     if (CanShowTab(objTab, TabPermissionController.CanAdminPage(), true))
     {
         NodeCollection objParentNodes;
         Node objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString());
         bool blnParentFound = objParentNode != null;
         if (objParentNode == null)
             objParentNode = objRootNode;
         objParentNodes = objParentNode.Nodes;
         if (objTab.TabID == intStartTabId)
         {
             if ((intNavNodeOptions & (int)NavNodeOptions.IncludeParent) != 0)
             {
                 if (objTabLookup[objTab.ParentId] != null)
                 {
                     AddNode((TabInfo)objTabLookup[objTab.ParentId], objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
                     objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString());
                     objParentNodes = objParentNode.Nodes;
                 }
             }
             if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) != 0)
             {
                 AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
             }
         }
         else if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) && IsTabSibling(objTab, intStartTabId, objTabLookup))
         {
             AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
         }
         else
         {
             if (blnParentFound)
             {
                 if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) || IsTabSibling(objTab, intStartTabId, objTabLookup) == false)
                 {
                     bool blnPOD = (intNavNodeOptions & (int)NavNodeOptions.MarkPendingNodes) != 0;
                     if (IsTabPending(objTab, objParentNode, objRootNode, intDepth, objBreadCrumbs, intLastBreadCrumbId, blnPOD))
                     {
                         if (blnPOD)
                         {
                             objParentNode.HasNodes = true;
                         }
                     }
                     else
                     {
                         AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
                     }
                 }
             }
             else if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) == 0 && objTab.ParentId == intStartTabId)
             {
                 AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
             }
         }
     }
 }
コード例 #8
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddModuleToPage adds a module to a Page
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="page">The Page to add the Module to</param>
        ///	<param name="ModuleDefId">The Module Deinition Id for the module to be aded to this tab</param>
        ///	<param name="ModuleTitle">The Module's title</param>
        ///	<param name="ModuleIconFile">The Module's icon</param>
        ///	<param name="InheritPermissions">Inherit the Pages View Permisions</param>
        /// <history>
        /// [cnurse]	11/16/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int AddModuleToPage(TabInfo page, int ModuleDefId, string ModuleTitle, string ModuleIconFile, bool InheritPermissions)
        {
            ModuleController objModules = new ModuleController();
            ModuleInfo objModule = new ModuleInfo();
            bool blnDuplicate = false;
            int moduleId = Null.NullInteger;

            if ((page != null))
            {
                blnDuplicate = false;
                foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(page.TabID))
                {
                    objModule = kvp.Value;
                    if (objModule.ModuleDefID == ModuleDefId)
                    {
                        blnDuplicate = true;
                        moduleId = objModule.ModuleID;
                    }
                }

                if (!blnDuplicate)
                {
                    objModule = new ModuleInfo();
                    objModule.ModuleID = Null.NullInteger;
                    objModule.PortalID = page.PortalID;
                    objModule.TabID = page.TabID;
                    objModule.ModuleOrder = -1;
                    objModule.ModuleTitle = ModuleTitle;
                    objModule.PaneName = Globals.glbDefaultPane;
                    objModule.ModuleDefID = ModuleDefId;
                    objModule.CacheTime = 0;
                    objModule.IconFile = ModuleIconFile;
                    objModule.AllTabs = false;
                    objModule.Visibility = VisibilityState.None;
                    objModule.InheritViewPermissions = InheritPermissions;

                    try
                    {
                        moduleId = objModules.AddModule(objModule);
                    }
                    catch
                    {
                    }
                    // error adding module
                }
            }

            return moduleId;
        }
コード例 #9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddPage adds a Tab Page
        /// </summary>
        /// <remarks>
        /// Adds a Tab to a parentTab
        /// </remarks>
        ///	<param name="parentTab">The Parent Tab</param>
        ///	<param name="TabName">The Name to give this new Tab</param>
        ///	<param name="TabIconFile">The Icon for this new Tab</param>
        ///	<param name="IsVisible">A flag indicating whether the tab is visible</param>
        ///	<param name="permissions">Page Permissions Collection for this page</param>
        /// <param name="IsAdmin">Is an admin page</param>
        /// <history>
        /// [cnurse]	11/11/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static TabInfo AddPage(TabInfo parentTab, string TabName, string Description, string TabIconFile, string TabIconFileLarge, bool IsVisible, Security.Permissions.TabPermissionCollection permissions, bool IsAdmin)
        {

            int ParentId = Null.NullInteger;
            int PortalId = Null.NullInteger;

            if ((parentTab != null))
            {
                ParentId = parentTab.TabID;
                PortalId = parentTab.PortalID;
            }


            return AddPage(PortalId, ParentId, TabName, Description, TabIconFile, TabIconFileLarge, IsVisible, permissions, IsAdmin);
        }
コード例 #10
0
 private void UpdateTabOrder(TabInfo objTab, bool updateTabPath)
 {
     if (updateTabPath)
     {
         objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName);
     }
     provider.UpdateTabOrder(objTab.TabID, objTab.TabOrder, objTab.Level, objTab.ParentId, objTab.TabPath, UserController.GetCurrentUserInfo().UserID);
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     objEventLog.AddLog(objTab, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", Services.Log.EventLog.EventLogController.EventLogType.TAB_ORDER_UPDATED);
 }
コード例 #11
0
 public int AddTab(TabInfo objTab)
 {
     return AddTab(objTab, true);
 }
コード例 #12
0
 private void RemoveTab(TabInfo objTab)
 {
     List<TabInfo> siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId);
     int siblingCount = siblingTabs.Count;
     for (int index = 0; index <= siblingCount - 1; index++)
     {
         TabInfo sibling = siblingTabs[index];
         if (sibling.TabID == objTab.TabID)
         {
             UpdateTabOrder(siblingTabs, index + 1, siblingCount - 1, -2);
             break;
         }
     }
 }
コード例 #13
0
 private void SwapAdjacentTabs(TabInfo firstTab, TabInfo secondTab)
 {
     firstTab.TabOrder -= 2;
     UpdateTabOrder(firstTab, false);
     secondTab.TabOrder += 2;
     UpdateTabOrder(secondTab, false);
 }
コード例 #14
0
 private void PromoteTab(TabInfo objTab, List<TabInfo> siblingTabs)
 {
     int siblingCount = siblingTabs.Count;
     TabInfo parentTab = GetTab(objTab.ParentId, objTab.PortalID, false);
     if (parentTab != null)
     {
         int tabIndex = GetIndexOfTab(objTab, siblingTabs);
         UpdateTabOrder(siblingTabs, tabIndex + 1, siblingCount - 1, -2);
         siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(parentTab.ParentId);
         siblingCount = siblingTabs.Count;
         UpdateTabOrder(siblingTabs, 2);
         int parentIndex = GetIndexOfTab(parentTab, siblingTabs);
         UpdateTabOrder(siblingTabs, parentIndex + 1, siblingCount - 1, 2);
         List<TabInfo> descendantTabs = GetTabsByPortal(objTab.PortalID).DescendentsOf(objTab.TabID);
         objTab.ParentId = parentTab.ParentId;
         objTab.TabOrder = parentTab.TabOrder + 2;
         UpdateTab(objTab);
         //objTab.Level = objTab.Level - 1;
         //UpdateTabOrder(objTab, true);
         UpdateDescendantLevel(descendantTabs, -1);
     }
 }
コード例 #15
0
 private int GetIndexOfTab(TabInfo objTab, List<TabInfo> tabs)
 {
     int tabIndex = Null.NullInteger;
     for (int index = 0; index <= tabs.Count - 1; index++)
     {
         if (tabs[index].TabID == objTab.TabID)
         {
             tabIndex = index;
             break;
         }
     }
     return tabIndex;
 }
コード例 #16
0
 private void DemoteTab(TabInfo objTab, List<TabInfo> siblingTabs)
 {
     int siblingCount = siblingTabs.Count;
     int tabIndex = GetIndexOfTab(objTab, siblingTabs);
     if (tabIndex > 0)
     {
         UpdateTabOrder(siblingTabs, tabIndex + 1, siblingCount - 1, -2);
         TabInfo parentTab = siblingTabs[tabIndex - 1];
         List<TabInfo> descendantTabs = GetTabsByPortal(objTab.PortalID).DescendentsOf(objTab.TabID);
         objTab.ParentId = parentTab.TabID;
         AddTabToEndOfList(objTab, true);
         UpdateDescendantLevel(descendantTabs, 1);
     }
 }
コード例 #17
0
 public abstract string FriendlyUrl(TabInfo tab, string path, string pageName, string portalAlias);
コード例 #18
0
 public int AddTab(TabInfo objTab, bool includeAllTabsModules)
 {
     int tabID = AddTabInternal(objTab, includeAllTabsModules);
     AddTabToEndOfList(objTab, false);
     ClearCache(objTab.PortalID);
     DataCache.RemoveCache(DataCache.PortalDictionaryCacheKey);
     return tabID;
 }
コード例 #19
0
        private static void UpgradeToVersion_530()
        {
            int ModuleDefID = 0;

            //update languages module
            ModuleDefID = GetModuleDefinition("Languages", "Languages");
            RemoveModuleControl(ModuleDefID, "");
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Languages/languageEnabler.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0, "", true);
            AddModuleControl(ModuleDefID, "Editor", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);

            //Add new View Profile module
            ModuleDefID = AddModuleDefinition("ViewProfile", "", "ViewProfile", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/ViewProfile/ViewProfile.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.View, 0);
            AddModuleControl(ModuleDefID, "Settings", "Settings", "DesktopModules/Admin/ViewProfile/Settings.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.Edit, 0);

            //Add new Sitemap settings module
            ModuleDefID = AddModuleDefinition("Sitemap", "", "Sitemap", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Sitemap/SitemapSettings.ascx", "~/images/icon_analytics_32px.gif", SecurityAccessLevel.View, 0);
            AddAdminPages("Search Engine Sitemap", "Configure the sitemap for submission to common search engines.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, ModuleDefID, "Search Engine Sitemap", "~/images/icon_analytics_32px.gif");


            //Add new Photo Profile field to Host
            ListController objListController = new ListController();
            ListEntryInfoCollection dataTypes = objListController.GetListEntryInfoCollection("DataType");

            ProfilePropertyDefinitionCollection properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger);
            ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, dataTypes);

            string strHostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath);
            if (File.Exists(strHostTemplateFile))
            {
                TabController tabController = new TabController();
                PortalController objPortals = new PortalController();
                ArrayList arrPortals = objPortals.GetPortals();
                foreach (PortalInfo objPortal in arrPortals)
                {
                    properties = ProfileController.GetPropertyDefinitionsByPortal(objPortal.PortalID);

                    //Add new Photo Profile field to Portal
                    ProfileController.AddDefaultDefinition(objPortal.PortalID, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, dataTypes);

                    //Rename old Default Page template
                    File.Move(string.Format("{0}Templates\\Default.page.template", objPortal.HomeDirectoryMapPath), string.Format("{0}Templates\\Default_old.page.template", objPortal.HomeDirectoryMapPath));

                    //Update Default profile template in every portal
                    objPortals.CopyPageTemplate("Default.page.template", objPortal.HomeDirectoryMapPath);

                    //Add User profile template to every portal
                    objPortals.CopyPageTemplate("UserProfile.page.template", objPortal.HomeDirectoryMapPath);

                    //Synchronize the Templates folder to ensure the templates are accessible
                    FileSystemUtils.SynchronizeFolder(objPortal.PortalID, string.Format("{0}Templates\\", objPortal.HomeDirectoryMapPath), "Templates/", false, true, true, false);

                    XmlDocument xmlDoc = new XmlDocument();
                    try
                    {
                        // open the XML file
                        xmlDoc.Load(string.Format("{0}Templates\\UserProfile.page.template", objPortal.HomeDirectoryMapPath));
                    }
                    catch (Exception ex)
                    {
                        Exceptions.Exceptions.LogException(ex);
                    }

                    TabInfo newTab = new TabInfo();
                    newTab = TabController.DeserializeTab(xmlDoc.SelectSingleNode("//portal/tabs/tab"), null, objPortal.PortalID, PortalTemplateModuleAction.Merge);
                    TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), newTab.PortalID, newTab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable());

                    //Update SiteSettings to point to the new page
                    objPortal.RegisterTabId = objPortal.UserTabId;
                    objPortal.UserTabId = newTab.TabID;
                    objPortals.UpdatePortalInfo(objPortal);

                    //Add Users folder to every portal
                    string strUsersFolder = string.Format("{0}Users\\", objPortal.HomeDirectoryMapPath);

                    if (!Directory.Exists(strUsersFolder))
                    {
                        //Create Users folder
                        Directory.CreateDirectory(strUsersFolder);

                        //Synchronize the Users folder to ensure the user folder is accessible
                        FileSystemUtils.SynchronizeFolder(objPortal.PortalID, strUsersFolder, "Users/", false, true, true, false);
                    }
                }
            }

            //Add new EventQueue Event
            CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration config = CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration.GetConfig();
            if (config != null)
            {
                if (!config.PublishedEvents.ContainsKey("Application_Start_FirstRequest"))
                {
                    foreach (CommonLibrary.Services.EventQueue.Config.SubscriberInfo subscriber in config.EventQueueSubscribers.Values)
                    {
                        CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration.RegisterEventSubscription(config, "Application_Start_FirstRequest", subscriber);
                    }

                    EventQueueConfiguration.SaveConfig(config, string.Format("{0}EventQueue\\EventQueue.config", Globals.HostMapPath));
                }
            }
            //Change Key for Module Defintions
            ModuleDefID = GetModuleDefinition("Extensions", "Extensions");
            RemoveModuleControl(ModuleDefID, "ImportModuleDefinition");
            AddModuleControl(ModuleDefID, "EditModuleDefinition", "Edit Module Definition", "DesktopModules/Admin/Extensions/Editors/EditModuleDefinition.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);

            //Module was incorrectly assigned as "IsPremium=False"
            RemoveModuleFromPortals("Users And Roles");
        }
コード例 #20
0
        public void MoveTabBefore(TabInfo objTab, int beforeTabId)
        {
            if ((objTab.TabID < 0))
            {
                return;
            }

            //Get the List of tabs with the same parent
            List<TabInfo> siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId);
            int siblingCount = siblingTabs.Count;

            //First make sure that the siblings are sorted correctly
            UpdateTabOrder(siblingTabs, 2);

            //New tab is to be inserted into the siblings List before TabId=beforeTabId
            for (int index = 0; index <= siblingCount - 1; index++)
            {
                TabInfo sibling = siblingTabs[index];
                if (sibling.TabID == beforeTabId)
                {
                    //we need to insert the tab here
                    objTab.Level = sibling.Level;
                    objTab.TabOrder = sibling.TabOrder;

                    //UpdateOrder - Parent hasn't changed so we don't need to regenerate TabPath
                    UpdateTabOrder(objTab, false);

                    //We need to update the taborder for the remaining items, including the current one
                    int remainingTabOrder = objTab.TabOrder;
                    for (int remainingIndex = index; remainingIndex <= siblingCount - 1; remainingIndex++)
                    {
                        TabInfo remainingTab = siblingTabs[remainingIndex];

                        if ((remainingTab.TabID == objTab.TabID))
                        {
                            continue;
                        }

                        remainingTabOrder = remainingTabOrder + 2;
                        remainingTab.TabOrder = remainingTabOrder;

                        //UpdateOrder - Parent hasn't changed so we don't need to regenerate TabPath
                        UpdateTabOrder(remainingTab, false);
                    }
                    break; // TODO: might not be correct. Was : Exit For
                }
            }

            //Clear the Cache
            ClearCache(objTab.PortalID);
        }
コード例 #21
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// AddModuleToPage adds a module to a Page
 /// </summary>
 /// <remarks>
 /// This overload assumes ModulePermissions will be inherited
 /// </remarks>
 ///	<param name="page">The Page to add the Module to</param>
 ///	<param name="ModuleDefId">The Module Deinition Id for the module to be aded to this tab</param>
 ///	<param name="ModuleTitle">The Module's title</param>
 ///	<param name="ModuleIconFile">The Module's icon</param>
 /// <history>
 /// [cnurse]	11/11/2004	created
 /// </history>
 /// -----------------------------------------------------------------------------
 private static int AddModuleToPage(TabInfo page, int ModuleDefId, string ModuleTitle, string ModuleIconFile)
 {
     //Call overload with InheritPermisions=True
     return AddModuleToPage(page, ModuleDefId, ModuleTitle, ModuleIconFile, true);
 }
コード例 #22
0
 public int AddTabBefore(TabInfo objTab, int beforeTabId)
 {
     List<TabInfo> siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId);
     int siblingCount = siblingTabs.Count;
     UpdateTabOrder(siblingTabs, 2);
     int tabID = AddTabInternal(objTab, true);
     for (int index = 0; index <= siblingCount - 1; index++)
     {
         TabInfo sibling = siblingTabs[index];
         if (sibling.TabID == beforeTabId)
         {
             objTab.Level = sibling.Level;
             objTab.TabOrder = sibling.TabOrder;
             UpdateTabOrder(objTab, false);
             UpdateTabOrder(siblingTabs, index, siblingCount - 1, 2);
             break;
         }
     }
     ClearCache(objTab.PortalID);
     return tabID;
 }
コード例 #23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddPage adds a Tab Page
        /// </summary>
        ///	<param name="PortalId">The Id of the Portal</param>
        ///	<param name="ParentId">The Id of the Parent Tab</param>
        ///	<param name="TabName">The Name to give this new Tab</param>
        ///	<param name="TabIconFile">The Icon for this new Tab</param>
        ///	<param name="IsVisible">A flag indicating whether the tab is visible</param>
        ///	<param name="permissions">Page Permissions Collection for this page</param>
        /// <param name="IsAdmin">Is and admin page</param>
        /// <history>
        /// [cnurse]	11/11/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static TabInfo AddPage(int PortalId, int ParentId, string TabName, string Description, string TabIconFile, string TabIconFileLarge, bool IsVisible, Security.Permissions.TabPermissionCollection permissions, bool IsAdmin)
        {
            TabController objTabs = new TabController();
            TabInfo objTab = default(TabInfo);

            objTab = objTabs.GetTabByName(TabName, PortalId, ParentId);

            if (objTab == null || objTab.ParentId != ParentId)
            {
                objTab = new TabInfo();
                objTab.TabID = Null.NullInteger;
                objTab.PortalID = PortalId;
                objTab.TabName = TabName;
                objTab.Title = "";
                objTab.Description = Description;
                objTab.KeyWords = "";
                objTab.IsVisible = IsVisible;
                objTab.DisableLink = false;
                objTab.ParentId = ParentId;
                objTab.IconFile = TabIconFile;
                objTab.IconFileLarge = TabIconFileLarge;
                objTab.IsDeleted = false;
                objTab.TabID = objTabs.AddTab(objTab, !IsAdmin);

                if (((permissions != null)))
                {
                    Security.Permissions.TabPermissionController tabPermissionCtrl = new Security.Permissions.TabPermissionController();
                    foreach (TabPermissionInfo tabPermission in permissions)
                    {
                        objTab.TabPermissions.Add(tabPermission, true);
                    }
                    TabPermissionController.SaveTabPermissions(objTab);
                }
            }

            return objTab;
        }
コード例 #24
0
        public void CreateContentItem(TabInfo updatedTab)
        {
            IContentTypeController typeController = new ContentTypeController();
            ContentType contentType = (from t in typeController.GetContentTypes()
                                       where t.Type == "Tab"
                                       select t).SingleOrDefault();

            //This tab does not have a valid ContentItem
            //create ContentItem
            IContentController contentController = Util.GetContentController();
            if (string.IsNullOrEmpty(updatedTab.Title))
            {
                updatedTab.Content = updatedTab.TabName;
            }
            else
            {
                updatedTab.Content = updatedTab.Title;
            }
            updatedTab.ContentTypeId = contentType.ContentTypeId;
            updatedTab.Indexed = false;
            updatedTab.ContentItemId = contentController.AddContentItem(updatedTab);
        }
コード例 #25
0
 private static bool IsTabSibling(TabInfo objTab, int intStartTabId, Hashtable objTabLookup)
 {
     if (intStartTabId == -1)
     {
         if (objTab.ParentId == -1)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else if (objTab.ParentId == ((TabInfo)objTabLookup[intStartTabId]).ParentId)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #26
0
 private void AddAllTabsModules(TabInfo objTab)
 {
     ModuleController objmodules = new ModuleController();
     foreach (ModuleInfo allTabsModule in objmodules.GetAllTabsModules(objTab.PortalID, true))
     {
         bool canAdd = false;
         foreach (ModuleInfo allTabsInstance in objmodules.GetModuleTabs(allTabsModule.ModuleID))
         {
             TabInfo tab = new TabController().GetTab(allTabsInstance.TabID, objTab.PortalID, false);
             if (!tab.IsDeleted)
             {
                 canAdd = true;
                 break;
             }
         }
         if (canAdd)
         {
             objmodules.CopyModule(allTabsModule.ModuleID, allTabsModule.TabID, objTab.TabID, "", true);
         }
     }
 }
コード例 #27
0
 public static bool CanShowTab(TabInfo objTab, bool isAdminMode, bool showDisabled)
 {
     if (objTab.IsVisible && !objTab.IsDeleted && (!objTab.DisableLink || showDisabled) && (((objTab.StartDate < DateTime.Now || objTab.StartDate == Null.NullDate) && (objTab.EndDate > DateTime.Now || objTab.EndDate == Null.NullDate)) || isAdminMode) && TabPermissionController.CanNavigateToPage(objTab))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #28
0
 public abstract string FriendlyUrl(TabInfo tab, string path, string pageName);
コード例 #29
0
 public abstract string FriendlyUrl(TabInfo tab, string path);
コード例 #30
0
        private int AddTabInternal(TabInfo objTab, bool includeAllTabsModules)
        {
            bool newTab = true;
            objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName);
            int iTabID = GetTabByTabPath(objTab.PortalID, objTab.TabPath);
            if (iTabID > Null.NullInteger)
            {
                throw new TabExistsException(iTabID, "Tab Exists");
            }
            else
            {
                //First create ContentItem as we need the ContentItemID
                IContentTypeController typeController = new ContentTypeController();
                ContentType contentType = (from t in typeController.GetContentTypes()
                                           where t.Type == "Tab"
                                           select t)
                                                 .SingleOrDefault();

                IContentController contentController = Util.GetContentController();
                if (String.IsNullOrEmpty(objTab.Title))
                {
                    objTab.Content = objTab.TabName;
                }
                else
                {
                    objTab.Content = objTab.Title;
                }
                objTab.ContentTypeId = contentType.ContentTypeId;
                objTab.Indexed = false;
                int contentItemID = contentController.AddContentItem(objTab);

                //Add Module
                iTabID = provider.AddTab(contentItemID, objTab.PortalID, objTab.TabName, objTab.IsVisible, objTab.DisableLink, objTab.ParentId, objTab.IconFile, objTab.IconFileLarge, objTab.Title, objTab.Description, objTab.KeyWords,
                objTab.Url, objTab.SkinSrc, objTab.ContainerSrc, objTab.TabPath, objTab.StartDate, objTab.EndDate, objTab.RefreshInterval, objTab.PageHeadText, objTab.IsSecure, objTab.PermanentRedirect,
                objTab.SiteMapPriority, UserController.GetCurrentUserInfo().UserID, PortalController.GetActivePortalLanguage(objTab.PortalID));
                objTab.TabID = iTabID;
                //Now we have the TabID - update the contentItem
                contentController.UpdateContentItem(objTab);

                ITermController termController = Util.GetTermController();
                termController.RemoveTermsFromContent(objTab);
                foreach (Term _Term in objTab.Terms)
                {
                    termController.AddTermToContent(_Term, objTab);
                }
                Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
                objEventLog.AddLog(objTab, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", Services.Log.EventLog.EventLogController.EventLogType.TAB_CREATED);
                TabPermissionController.SaveTabPermissions(objTab);
                try
                {
                    UpdateTabSettings(ref objTab);
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                }
                if (includeAllTabsModules)
                {
                    AddAllTabsModules(objTab);
                }
            }
            return objTab.TabID;
        }