コード例 #1
0
        public static void AddAdminPages(string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions)
        {
            var portalController = new PortalController();
            ArrayList portals = portalController.GetPortals();

            //Add Page to Admin Menu of all configured Portals
            for (int intPortal = 0; intPortal <= portals.Count - 1; intPortal++)
            {
                var portal = (PortalInfo)portals[intPortal];

                //Create New Admin Page (or get existing one)
                TabInfo newPage = Upgrade.AddAdminPage(portal, tabName, description, tabIconFile, tabIconFileLarge, isVisible);

                //Add Module To Page
                Upgrade.AddModuleToPage(newPage, moduleDefId, moduleTitle, moduleIconFile, inheritPermissions);
                var moduleController = new ModuleController();

                if (newPage != null) {
                    foreach (var module in moduleController.GetTabModules(newPage.TabID).Values)
                    {
                        moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
                    }
                }

            }
        }
コード例 #2
0
ファイル: ExtensionSteps.cs プロジェクト: ryanmalone/BGDNNWEB
 public void GivenAModuleOnThePage(string moduleName, Table permissions)
 {
     var controller = new ModuleController();
     var modules = controller.GetTabModules(Page.TabID);
     var module = modules.Where(m => m.Value.ModuleDefinition.FriendlyName == moduleName);
     if (!module.Any())
     {
         AddModuleToPage(Page, GetModuleDefinition(moduleName, moduleName), moduleName, "", true);
     }
 }
コード例 #3
0
        public GetAdminPayload GetAdmin(int tabId, int moduleId)
        {
            if (ValidateAuthentication() && HasPermission(moduleId))
            {
                ModuleController mc = new ModuleController();
                List<Modules> modules = mc.GetTabModules(tabId).Where(x => x.Value.IsDeleted == false && x.Value.ModuleID != moduleId)
                                          .Select(x => new Modules() {ModuleId = x.Key, Name = x.Value.ModuleTitle}).ToList();

                return new GetAdminPayload {CheckValues = DataController.GetChecks(moduleId),Modules = modules};
            }
            return null;
        }
コード例 #4
0
 public static List<ListItem> GetModuleList(string ModuleName)
 {
     List<ListItem> lst = new List<ListItem>();
     PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();
     List<TabInfo> objTabs = TabController.GetPortalTabs(portalSettings.PortalId, -1, true, true);
     var objTabController = new TabController();
     var objDesktopModuleController = new DesktopModuleController();
     var objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName(ModuleName);
     if (objDesktopModuleInfo == null)
     {
         objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName(ModuleName);
         if (objDesktopModuleInfo == null)
         {
             return lst;
         }
     }
     foreach (TabInfo objTab in objTabs.Where(tab => !tab.IsDeleted))
     {
         ModuleController objModules = new ModuleController();
         foreach (KeyValuePair<int, ModuleInfo> pair in objModules.GetTabModules(objTab.TabID))
         {
             ModuleInfo objModule = pair.Value;
             if (objModule.IsDeleted)
             {
                 continue;
             }
             if (objModule.DesktopModuleID != objDesktopModuleInfo.DesktopModuleID)
             {
                 continue;
             }
             string strPath = objTab.TabName;
             TabInfo objTabSelected = objTab;
             while (objTabSelected.ParentId != Null.NullInteger)
             {
                 objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, false);
                 if (objTabSelected == null)
                 {
                     break;
                 }
                 strPath = string.Format("{0} -> {1}", objTabSelected.TabName, strPath);
             }
             var objListItem = new ListItem
             {
                 Value = objModule.ModuleID.ToString(),
                 Text = string.Format("{0} -> {1}", strPath, objModule.ModuleTitle)
             };
             lst.Add(objListItem);
         }
     }
     return lst;
 }
コード例 #5
0
        public string UpgradeModule(string Version)
        {
            try
            {
                switch (Version)
                {
                    case "06.02.00":
                        var portalController = new PortalController();
                        var moduleController = new ModuleController();
                        var tabController = new TabController();

                        var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center");
                        if (moduleDefinition != null)
                        {
                            var portals = portalController.GetPortals();
                            foreach (PortalInfo portal in portals)
                            {
                                if (portal.UserTabId > Null.NullInteger)
                                {
                                    //Find TabInfo
                                    var tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true);
                                    if (tab != null)
                                    {
                                        foreach (var module in moduleController.GetTabModules(portal.UserTabId).Values)
                                        {
                                            if (module.DesktopModule.FriendlyName == "Messaging")
                                            {
                                                //Delete the Module from the Modules list
                                                moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);

                                                //Add new module to the page
                                                Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true);

                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                }
                return "Success";
            }
            catch (Exception exc)
            {
                Logger.Error(exc);

                return "Failed";
            }
        }
コード例 #6
0
ファイル: ExtensionSteps.cs プロジェクト: ryanmalone/BGDNNWEB
        ///-----------------------------------------------------------------------------
        ///<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)
        {
            var moduleController = new ModuleController();
            ModuleInfo moduleInfo;
            int moduleId = Null.NullInteger;

            if ((page != null))
            {
                bool isDuplicate = false;
                foreach (var kvp in moduleController.GetTabModules(page.TabID))
                {
                    moduleInfo = kvp.Value;
                    if (moduleInfo.ModuleDefID == moduleDefId)
                    {
                        isDuplicate = true;
                        moduleId = moduleInfo.ModuleID;
                    }
                }

                if (!isDuplicate)
                {
                    moduleInfo = new ModuleInfo
                    {
                        ModuleID = Null.NullInteger,
                        PortalID = page.PortalID,
                        TabID = page.TabID,
                        ModuleOrder = -1,
                        ModuleTitle = moduleTitle,
                        PaneName = Globals.glbDefaultPane,
                        ModuleDefID = moduleDefId,
                        CacheTime = 0,
                        IconFile = moduleIconFile,
                        AllTabs = false,
                        Visibility = VisibilityState.None,
                        InheritViewPermissions = inheritPermissions
                    };
                    moduleId = moduleController.AddModule(moduleInfo);
                }
            }

            return moduleId;
        }
コード例 #7
0
        private static void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon, bool isVisible = true)
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo hostTab;

            // Get the module definition
            var moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);

            // Add pages
            var tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);
            if (tabId == Null.NullInteger)
            {
                //Add host page                
                hostTab = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, isVisible);
                hostTab.ParentId = parentId;
                tabController.UpdateTab(hostTab);

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
            else
            {
                hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
                foreach (
                    var kvp in
                        moduleController.GetTabModules(tabId)
                            .Where(kvp => kvp.Value.DesktopModule.ModuleName == moduleFriendlyName))
                {
                    // Remove previous module instance
                    moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
                    break;

                }

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
        }
コード例 #8
0
        public void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon)
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo hostTab;

            //Get web servers module
            ModuleDefinitionInfo moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);

            //Add Pages under Advanced Features Tab
            int tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);

            if (tabId == Null.NullInteger)
            {
                //Add host page
                hostTab = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true);
                hostTab.ParentId = parentId;
                tabController.UpdateTab(hostTab);

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
            else
            {
                hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
                foreach (var kvp in moduleController.GetTabModules(tabId))
                {
                    if (kvp.Value.DesktopModule.ModuleName == "ProfessionalPreview")
                    {
                        //Preview module so hard delete
                        moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
                        break;
                    }
                }
                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
        }
コード例 #9
0
		protected override void OnInit (EventArgs e)
		{
			base.OnInit (e);

			var mctrl = new ModuleController ();
			var docModules = new List<ModuleInfo>();

			// get all document modules (R7.Documents and DNN Documents)
			foreach (var module in mctrl.GetTabModules (TabId).Values)
			{
				var mdef = module.ModuleDefinition.DefinitionName.ToLowerInvariant();
				if (module.ModuleID != ModuleId && !module.IsDeleted && (mdef == "r7.documents" || mdef == "documents"))
					docModules.Add (module);
			}

			// fill modules combo
			comboModule.AddItem (LocalizeString ("NotSelected.Text"), Null.NullInteger.ToString ());
			foreach (var docModule in docModules)
				comboModule.AddItem (docModule.ModuleTitle, docModule.ModuleID.ToString());

			// set Cancel button link
			linkCancel.NavigateUrl = Globals.NavigateURL ();
		}
コード例 #10
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        private static void UpgradeToVersion500()
        {
            var portalController = new PortalController();
            ArrayList portals = portalController.GetPortals();
            var tabController = new TabController();

            //Add Edit Permissions for Admin Tabs to legacy portals
            var permissionController = new PermissionController();
            ArrayList permissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", "EDIT");
            int permissionId = -1;
            if (permissions.Count == 1)
            {
                var permission = permissions[0] as PermissionInfo;
                if (permission != null)
                {
                    permissionId = permission.PermissionID;
                }

                foreach (PortalInfo portal in portals)
                {
                    var adminTab = tabController.GetTab(portal.AdminTabId, portal.PortalID, true);
                    if (adminTab != null)
                    {
                        var tabPermission = new TabPermissionInfo {TabID = adminTab.TabID, PermissionID = permissionId, AllowAccess = true, RoleID = portal.AdministratorRoleId};
                        if (!TabPermissionExists(tabPermission, portal.PortalID))
                        {
                            adminTab.TabPermissions.Add(tabPermission);
                        }

                        //Save Tab Permissions to Data Base
                        TabPermissionController.SaveTabPermissions(adminTab);

                        foreach (var childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
                        {
                            tabPermission = new TabPermissionInfo {TabID = childTab.TabID, PermissionID = permissionId, AllowAccess = true, RoleID = portal.AdministratorRoleId};
                            if (!TabPermissionExists(tabPermission, portal.PortalID))
                            {
                                childTab.TabPermissions.Add(tabPermission);
                            }
                            //Save Tab Permissions to Data Base
                            TabPermissionController.SaveTabPermissions(childTab);
                        }
                    }
                }
            }

            //Update Host/Admin modules Visibility setting
            bool superTabProcessed = Null.NullBoolean;
            var moduleController = new ModuleController();
            foreach (PortalInfo portal in portals)
            {
                if (!superTabProcessed)
                {
                    //Process Host Tabs
                    foreach (TabInfo childTab in TabController.GetTabsByParent(portal.SuperTabId, Null.NullInteger))
                    {
                        foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
                        {
                            tabModule.Visibility = VisibilityState.None;
                            moduleController.UpdateModule(tabModule);
                        }
                    }
                }

                //Process Portal Tabs
                foreach (TabInfo childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
                {
                    foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
                    {
                        tabModule.Visibility = VisibilityState.None;
                        moduleController.UpdateModule(tabModule);
                    }
                }
            }

            //Upgrade PortalDesktopModules to support new "model"
            permissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_DESKTOPMODULE", "DEPLOY");
            if (permissions.Count == 1)
            {
                var permission = permissions[0] as PermissionInfo;
                if (permission != null)
                {
                    permissionId = permission.PermissionID;
                }
                foreach (PortalInfo portal in portals)
                {
                    foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values)
                    {
                        if (!desktopModule.IsPremium)
                        {
                            //Parse the permissions
                            var deployPermissions = new DesktopModulePermissionCollection();
                            DesktopModulePermissionInfo deployPermission;

                            // if Not IsAdmin add Registered Users
                            if (!desktopModule.IsAdmin)
                            {
                                deployPermission = new DesktopModulePermissionInfo {PermissionID = permissionId, AllowAccess = true, RoleID = portal.RegisteredRoleId};
                                deployPermissions.Add(deployPermission);
                            }

                            // if Not a Host Module add Administrators
                            const string hostModules = "Portals, SQL, HostSettings, Scheduler, SearchAdmin, Lists, SkinDesigner, Extensions";
                            if (!hostModules.Contains(desktopModule.ModuleName))
                            {
                                deployPermission = new DesktopModulePermissionInfo {PermissionID = permissionId, AllowAccess = true, RoleID = portal.AdministratorRoleId};
                                deployPermissions.Add(deployPermission);
                            }

                            //Add Portal/Module to PortalDesktopModules
                            DesktopModuleController.AddDesktopModuleToPortal(portal.PortalID, desktopModule, deployPermissions, false);
                        }
                    }

                    DataCache.ClearPortalCache(portal.PortalID, true);
                }
            }

            LegacyUtil.ProcessLegacyModules();
            LegacyUtil.ProcessLegacyLanguages();
            LegacyUtil.ProcessLegacySkins();
            LegacyUtil.ProcessLegacySkinControls();
        }
コード例 #11
0
        private List<ModuleInfo> LoadTabModules()
        {
            var moduleCtl = new ModuleController();
            var moduleList = new List<ModuleInfo>();

            //Check if we have module scope
            if (ModuleId > Null.NullInteger)
            {
                ModuleInfo sourceModule = moduleCtl.GetModule(ModuleId, TabId);
                if (sourceModule.LocalizedModules != null)
                {
                    foreach (ModuleInfo localizedModule in sourceModule.LocalizedModules.Values)
                    {
                        moduleList.Add(localizedModule);
                    }
                }
            }
            else
            {
                foreach (ModuleInfo m in moduleCtl.GetTabModules(TabId).Values)
                {
                    if (!m.IsDeleted)
                    {
                        moduleList.Add(m);
                        if (m.LocalizedModules != null)
                        {
                            foreach (ModuleInfo localizedModule in m.LocalizedModules.Values)
                            {
                                moduleList.Add(localizedModule);
                            }
                        }
                    }
                }
            }

            return moduleList;
        }
コード例 #12
0
        protected void GrdModulesNeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            var lst = new List<ModuleInfo>();

            if (ctlPages.SelectedNode != null)
            {
                var tabid = Convert.ToInt32(ctlPages.SelectedNode.Value);
                var moduleController = new ModuleController();
                var dic = moduleController.GetTabModules(tabid);

                lst.AddRange(dic.Values.Where(objModule => objModule.IsDeleted == false));
            }

            grdModules.DataSource = lst;
        }
コード例 #13
0
        private List<ModuleInfo> LoadTabModules(int TabID)
        {
            var moduleCtl = new ModuleController();
            var moduleList = new List<ModuleInfo>();

            foreach (var m in moduleCtl.GetTabModules(TabID).Values)
            {
                if (TabPermissionController.CanAddContentToPage() && !m.IsDeleted && !m.AllTabs)
                {
                    moduleList.Add(m);
                }
            }

            return moduleList;
        }
コード例 #14
0
        /// <summary>
        /// Serializes all portal Tabs
        /// </summary>
        /// <param name="xmlTemplate">Reference to XmlDocument context</param>
        /// <param name="nodeTabs">Node to add the serialized objects</param>
        /// <param name="objportal">Portal to serialize</param>
        /// <param name="hRoles">A hastable with all serialized roles</param>
        /// <remarks>
        /// Only portal tabs will be exported to the template, Admin tabs are not exported.
        /// On each tab, all modules will also be exported.
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	23/09/2004	Created
        /// </history>
        public void SerializeTabs( XmlDocument xmlTemplate, XmlNode nodeTabs, PortalInfo objportal, Hashtable hRoles )
        {
            TabController objtabs = new TabController();

            //supporting object to build the tab hierarchy
            Hashtable hTabs = new Hashtable();

            XmlSerializer xserTabs = new XmlSerializer( typeof( TabInfo ) );
            foreach( TabInfo objtab in objtabs.GetTabs( objportal.PortalID ) )
            {
                //if not an admin tab & not deleted
                if( objtab.TabOrder < 10000 && ! objtab.IsDeleted )
                {
                    StringWriter sw = new StringWriter();
                    xserTabs.Serialize( sw, objtab );

                    XmlDocument xmlTab = new XmlDocument();
                    xmlTab.LoadXml( sw.GetStringBuilder().ToString() );
                    XmlNode nodeTab = xmlTab.SelectSingleNode( "tab" );
                    nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsd"] );
                    nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsi"] );

                    XmlNode newnode;
                    if( objtab.TabID == objportal.SplashTabId )
                    {
                        newnode = xmlTab.CreateElement( "tabtype" );
                        newnode.InnerXml = "splashtab";
                        nodeTab.AppendChild( newnode );
                    }
                    else if( objtab.TabID == objportal.HomeTabId )
                    {
                        newnode = xmlTab.CreateElement( "tabtype" );
                        newnode.InnerXml = "hometab";
                        nodeTab.AppendChild( newnode );
                    }
                    else if( objtab.TabID == objportal.UserTabId )
                    {
                        newnode = xmlTab.CreateElement( "tabtype" );
                        newnode.InnerXml = "usertab";
                        nodeTab.AppendChild( newnode );
                    }
                    else if( objtab.TabID == objportal.LoginTabId )
                    {
                        newnode = xmlTab.CreateElement( "tabtype" );
                        newnode.InnerXml = "logintab";
                        nodeTab.AppendChild( newnode );
                    }

                    if( ! Null.IsNull( objtab.ParentId ) )
                    {
                        newnode = xmlTab.CreateElement( "parent" );
                        newnode.InnerXml = Server.HtmlEncode( hTabs[objtab.ParentId].ToString() );
                        nodeTab.AppendChild( newnode );

                        // save tab as: ParentTabName/CurrentTabName
                        hTabs.Add( objtab.TabID, hTabs[objtab.ParentId] + "/" + objtab.TabName );
                    }
                    else
                    {
                        // save tab as: CurrentTabName
                        hTabs.Add( objtab.TabID, objtab.TabName );
                    }

                    // Serialize modules
                    XmlNode nodePanes;
                    nodePanes = nodeTab.AppendChild( xmlTab.CreateElement( "panes" ) );
                    ModuleController objmodules = new ModuleController();
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();

                    XmlSerializer xserModules = new XmlSerializer( typeof( ModuleInfo ) );
                    Dictionary<int, ModuleInfo> dict = objmodules.GetTabModules(objtab.TabID);
                    foreach( KeyValuePair<int, ModuleInfo> pair in dict )
                    {                        
                        ModuleInfo objmodule = pair.Value;

                        if (!objmodule.IsDeleted)
                        {
                            sw = new StringWriter();
                            xserModules.Serialize(sw, objmodule);

                            XmlDocument xmlModule = new XmlDocument();
                            xmlModule.LoadXml(sw.GetStringBuilder().ToString());
                            XmlNode nodeModule = xmlModule.SelectSingleNode("module");
                            nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsd"]);
                            nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsi"]);

                            if (nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']") == null)
                            {
                                // new pane found
                                XmlNode nodePane = xmlModule.CreateElement("pane");
                                XmlNode nodeName = nodePane.AppendChild(xmlModule.CreateElement("name"));
                                nodeName.InnerText = objmodule.PaneName;
                                nodePane.AppendChild(xmlModule.CreateElement("modules"));
                                nodePanes.AppendChild(xmlTab.ImportNode(nodePane, true));
                            }
                            XmlNode nodeModules = nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']/modules");
                            newnode = xmlModule.CreateElement("definition");

                            ModuleDefinitionInfo objModuleDef = objModuleDefController.GetModuleDefinition(objmodule.ModuleDefID);
                            newnode.InnerText = objDesktopModules.GetDesktopModule(objModuleDef.DesktopModuleID).ModuleName;
                            nodeModule.AppendChild(newnode);

                            //Add Module Definition Info
                            XmlNode nodeDefinition = xmlModule.CreateElement("moduledefinition");
                            nodeDefinition.InnerText = objModuleDef.FriendlyName;
                            nodeModule.AppendChild(nodeDefinition);

                            if (chkContent.Checked)
                            {
                                AddContent(nodeModule, objmodule);
                            }

                            nodeModules.AppendChild(xmlTab.ImportNode(nodeModule, true));
                        }
                    }
                    nodeTabs.AppendChild( xmlTemplate.ImportNode( nodeTab, true ) );
                }
            }
        }
コード例 #15
0
        protected void publishPageButton_Click(object sender, EventArgs e)
        {
            var tabCtrl = new TabController();
            var modCtrl = new ModuleController();

            //First mark all modules as translated
            foreach (ModuleInfo m in modCtrl.GetTabModules(Tab.TabID).Values)
            {
                modCtrl.UpdateTranslationStatus(m, true);
            }

            //First mark tab as translated
            tabCtrl.UpdateTranslationStatus(Tab, true);

            //Next publish Tab (update Permissions)
            tabCtrl.PublishTab(Tab);

            //Redirect to refresh page (and skinobjects)
            Response.Redirect(Request.RawUrl, true);
        }
コード例 #16
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        private static int RemoveModule(string desktopModuleName, string tabName, int parentId, bool removeTab)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "RemoveModule:" + desktopModuleName);
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo tab = tabController.GetTabByName(tabName, Null.NullInteger, parentId);
            int moduleDefId = 0;
            int count = 0;

            //Get the Modules on the Tab
            if (tab != null)
            {
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
                {
                    var module = kvp.Value;
                    if (module.DesktopModule.FriendlyName == desktopModuleName)
                    {
                        //Delete the Module from the Modules list
                        moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
                        moduleDefId = module.ModuleDefID;
                    }
                    else
                    {
                        count += 1;
                    }
                }

                //If Tab has no modules optionally remove tab
                if (count == 0 && removeTab)
                {
                    tabController.DeleteTab(tab.TabID, tab.PortalID);
                }
            }

            return moduleDefId;
        }
コード例 #17
0
        /// <summary>
        /// Processess a template file for the new portal. This method will be called twice: for the portal template and for the admin template
        /// </summary>
        /// <param name="PortalId">PortalId of the new portal</param>
        /// <param name="TemplatePath">Path for the folder where templates are stored</param>
        /// <param name="TemplateFile">Template file to process</param>
        /// <param name="AdministratorId">UserId for the portal administrator. This is used to assign roles to this user</param>
        /// <param name="mergeTabs">Flag to determine whether Module content is merged.</param>
        /// <param name="IsNewPortal">Flag to determine is the template is applied to an existing portal or a new one.</param>
        /// <remarks>
        /// The roles and settings nodes will only be processed on the portal template file.
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	27/08/2004	Created
        /// </history>
        public void ParseTemplate( int PortalId, string TemplatePath, string TemplateFile, int AdministratorId, PortalTemplateModuleAction mergeTabs, bool IsNewPortal )
        {
            XmlDocument xmlDoc = new XmlDocument();
            XmlNode node = null;
            int AdministratorRoleId = -1;
            int RegisteredRoleId = -1;
            int SubscriberRoleId = -1;
            RoleController objrole = new RoleController();
            bool isAdminTemplate = false;

            isAdminTemplate = ( TemplateFile == "admin.template" );

            // open the XML file
            try
            {
                xmlDoc.Load( TemplatePath + TemplateFile );
            }
            catch // error
            {
                // 
            }

            // settings, roles, folders and files can only be specified in portal templates, will be ignored on the admin template
            if( !isAdminTemplate )
            {
                // parse roles if available
                node = xmlDoc.SelectSingleNode( "//portal/roles" );
                if( node != null )
                {
                    ParseRoles( node, PortalId, AdministratorId, ref AdministratorRoleId, ref RegisteredRoleId, ref SubscriberRoleId );
                }

                // create required roles if not already created
                if( AdministratorRoleId == -1 )
                {
                    AdministratorRoleId = CreateRole( PortalId, "Administrators", "Portal Administrators", 0F, 0, "M", 0F, 0, "N", false, false );
                }
                if( RegisteredRoleId == -1 )
                {
                    RegisteredRoleId = CreateRole( PortalId, "Registered Users", "Registered Users", 0F, 0, "M", 0F, 0, "N", false, true );
                }
                if( SubscriberRoleId == -1 )
                {
                    SubscriberRoleId = CreateRole( PortalId, "Subscribers", "A public role for portal subscriptions", 0F, 0, "M", 0F, 0, "N", true, true );
                }

                objrole.AddUserRole( PortalId, AdministratorId, AdministratorRoleId, Null.NullDate, Null.NullDate );
                objrole.AddUserRole( PortalId, AdministratorId, RegisteredRoleId, Null.NullDate, Null.NullDate );
                objrole.AddUserRole( PortalId, AdministratorId, SubscriberRoleId, Null.NullDate, Null.NullDate );

                // parse portal folders
                node = xmlDoc.SelectSingleNode( "//portal/folders" );
                if( node != null )
                {
                    ParseFolders( node, PortalId );
                }
                // force creation of root folder if not present on template
                FolderController objController = new FolderController();
                if( objController.GetFolder( PortalId, "" ) == null )
                {
                    int folderid = objController.AddFolder( PortalId, "", (int)FolderController.StorageLocationTypes.InsecureFileSystem, true, false );
                    PermissionController objPermissionController = new PermissionController();
                    ArrayList arr = objPermissionController.GetPermissionByCodeAndKey( "SYSTEM_FOLDER", "" );
                    foreach( PermissionInfo objpermission in arr )
                    {
                        FileSystemUtils.SetFolderPermission( PortalId, folderid, objpermission.PermissionID, AdministratorRoleId, "" );
                        if( objpermission.PermissionKey == "READ" )
                        {
                            // add READ permissions to the All Users Role
                            FileSystemUtils.SetFolderPermission( PortalId, folderid, objpermission.PermissionID, int.Parse( Globals.glbRoleAllUsers ), "" );
                        }
                    }
                }

                // parse portal settings if available only for new portals
                node = xmlDoc.SelectSingleNode( "//portal/settings" );
                if( node != null & IsNewPortal )
                {
                    ParsePortalSettings( node, PortalId );
                }

                // update portal setup
                PortalInfo objportal = null;
                objportal = GetPortal( PortalId );
                UpdatePortalSetup( PortalId, AdministratorId, AdministratorRoleId, RegisteredRoleId, objportal.SplashTabId, objportal.HomeTabId, objportal.LoginTabId, objportal.UserTabId, objportal.AdminTabId );

                //Remove Exising Tabs if doing a "Replace"
                if( mergeTabs == PortalTemplateModuleAction.Replace )
                {
                    TabController objTabs = new TabController();
                    TabInfo objTab = null;
                    foreach( KeyValuePair<int, TabInfo> tabPair in objTabs.GetTabsByPortal( PortalId ) )
                    {
                        objTab = tabPair.Value;
                        if( !objTab.IsAdminTab )
                        {
                            //soft delete Tab
                            objTab.TabName = objTab.TabName + "_old";
                            objTab.IsDeleted = true;
                            objTabs.UpdateTab( objTab );
                            //Delete all Modules
                            ModuleController objModules = new ModuleController();
                            ModuleInfo objModule = null;
                            foreach( KeyValuePair<int, ModuleInfo> modulePair in objModules.GetTabModules( objTab.TabID ) )
                            {
                                objModule = modulePair.Value;
                                objModules.DeleteTabModule( objModule.TabID, objModule.ModuleID );
                            }
                        }
                    }
                }
            }

            // parse portal tabs
            node = xmlDoc.SelectSingleNode( "//portal/tabs" );
            if( node != null )
            {
                ParseTabs( node, PortalId, isAdminTemplate, mergeTabs, IsNewPortal );
            }
        }
コード例 #18
0
        /// <summary>
        /// Processes all panes and modules in the template file
        /// </summary>
        /// <param name="nodePanes">Template file node for the panes is current tab</param>
        /// <param name="PortalId">PortalId of the new portal</param>
        /// <param name="TabId">Tab being processed</param>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	03/09/2004	Created
        /// 	[VMasanas]	15/10/2004	Modified for new skin structure
        ///		[cnurse]	15/10/2004	Modified to allow for merging template
        ///								with existing pages
        /// </history>
        public void ParsePanes( XmlNode nodePanes, int PortalId, int TabId, PortalTemplateModuleAction mergeTabs, Hashtable hModules )
        {
            XmlNode nodePane = null;
            XmlNode nodeModule = null;
            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
            ModuleDefinitionInfo objModuleDefinition = null;
            ModuleController objModules = new ModuleController();
            Dictionary<int, ModuleInfo> dicModules = objModules.GetTabModules( TabId );
            ModuleInfo objModule = null;
            int intModuleId = 0;
            string modTitle = null;
            bool moduleFound = false;

            PortalInfo objportal = null;
            objportal = GetPortal( PortalId );

            //If Mode is Replace remove all the modules already on this Tab
            if( mergeTabs == PortalTemplateModuleAction.Replace )
            {
                foreach( KeyValuePair<int, ModuleInfo> kvp in dicModules )
                {
                    objModule = kvp.Value;
                    objModules.DeleteTabModule( TabId, objModule.ModuleID );
                }
            }

            // iterate through the panes
            foreach( XmlNode nodePaneWithinLoop in nodePanes.ChildNodes )
            {
                nodePane = nodePaneWithinLoop;

                // iterate through the modules
                if( nodePaneWithinLoop.SelectSingleNode( "modules" ) != null )
                {
                    foreach( XmlNode nodeModuleWithinLoop in nodePaneWithinLoop.SelectSingleNode( "modules" ) )
                    {
                        nodeModule = nodeModuleWithinLoop;
                        // will be instance or module?
                        int templateModuleID = XmlUtils.GetNodeValueInt( nodeModule, "moduleID", 0 );
                        bool IsInstance = false;
                        if( templateModuleID > 0 )
                        {
                            if( hModules[templateModuleID] != null )
                            {
                                // this module has already been processed -> process as instance
                                IsInstance = true;
                            }
                        }

                        // Templates prior to v4.3.5 only have the <definition> node to define the Module Type
                        // This <definition> node was populated with the DesktopModuleInfo.ModuleName property
                        // Thus there is no mechanism to determine to which module definition the module belongs.
                        //
                        // Template from v4.3.5 on also have the <moduledefinition> element that is populated
                        // with the ModuleDefinitionInfo.FriendlyName.  Therefore the module Instance identifies
                        // which Module Definition it belongs to.

                        //Get the DesktopModule defined by the <definition> element
                        DesktopModuleInfo objDesktopModule = Globals.GetDesktopModuleByName( XmlUtils.GetNodeValue( nodeModule, "definition", "" ) );
                        if( objDesktopModule != null )
                        {
                            //Get the moduleDefinition from the <moduledefinition> element
                            string friendlyName = XmlUtils.GetNodeValue( nodeModule, "moduledefinition", "" );

                            if( string.IsNullOrEmpty( friendlyName ) )
                            {
                                //Module is pre 4.3.5 so get the first Module Definition (at least it won't throw an error then)
                                ArrayList arrModuleDefinitions = objModuleDefinitions.GetModuleDefinitions( objDesktopModule.DesktopModuleID );
                                objModuleDefinition = (ModuleDefinitionInfo)( arrModuleDefinitions[0] );
                            }
                            else
                            {
                                //Module is 4.3.5 or later so get the Module Defeinition by its friendly name
                                objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName( objDesktopModule.DesktopModuleID, friendlyName );
                            }

                            if( objModuleDefinition != null )
                            {
                                //If Mode is Merge Check if Module exists
                                moduleFound = false;
                                modTitle = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "title", "" );
                                if( mergeTabs == PortalTemplateModuleAction.Merge )
                                {
                                    foreach( KeyValuePair<int, ModuleInfo> kvp in dicModules )
                                    {
                                        objModule = kvp.Value;
                                        if( modTitle == objModule.ModuleTitle )
                                        {
                                            moduleFound = true;
                                            break;
                                        }
                                    }
                                }

                                if( moduleFound == false )
                                {
                                    //Create New Module
                                    objModule = new ModuleInfo();
                                    objModule.PortalID = PortalId;
                                    objModule.TabID = TabId;
                                    objModule.ModuleOrder = -1;
                                    objModule.ModuleTitle = modTitle;
                                    objModule.PaneName = XmlUtils.GetNodeValue( nodePaneWithinLoop, "name", "" );
                                    objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                                    objModule.CacheTime = XmlUtils.GetNodeValueInt( nodeModuleWithinLoop, "cachetime", 0 );
                                    objModule.Alignment = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "alignment", "" );
                                    objModule.IconFile = ImportFile( PortalId, XmlUtils.GetNodeValue( nodeModuleWithinLoop, "iconfile", "" ) );
                                    objModule.AllTabs = XmlUtils.GetNodeValueBoolean( nodeModuleWithinLoop, "alltabs", false );
                                    switch( XmlUtils.GetNodeValue( nodeModuleWithinLoop, "visibility", "" ) )
                                    {
                                        case "Maximized":
                                            objModule.Visibility = VisibilityState.Maximized;
                                            break;
                                        case "Minimized":
                                            objModule.Visibility = VisibilityState.Minimized;
                                            break;
                                        case "None":
                                            objModule.Visibility = VisibilityState.None;
                                            break;
                                    }
                                    objModule.Color = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "color", "" );
                                    objModule.Border = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "border", "" );
                                    objModule.Header = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "header", "" );
                                    objModule.Footer = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "footer", "" );
                                    objModule.InheritViewPermissions = XmlUtils.GetNodeValueBoolean( nodeModuleWithinLoop, "inheritviewpermissions", false );
                                    objModule.ModulePermissions = new ModulePermissionCollection();

                                    objModule.StartDate = XmlUtils.GetNodeValueDate( nodeModuleWithinLoop, "startdate", Null.NullDate );
                                    objModule.EndDate = XmlUtils.GetNodeValueDate( nodeModuleWithinLoop, "enddate", Null.NullDate );

                                    if( XmlUtils.GetNodeValue( nodeModuleWithinLoop, "containersrc", "" ) != "" )
                                    {
                                        objModule.ContainerSrc = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "containersrc", "" );
                                    }
                                    objModule.DisplayTitle = XmlUtils.GetNodeValueBoolean( nodeModuleWithinLoop, "displaytitle", true );
                                    objModule.DisplayPrint = XmlUtils.GetNodeValueBoolean( nodeModuleWithinLoop, "displayprint", true );
                                    objModule.DisplaySyndicate = XmlUtils.GetNodeValueBoolean( nodeModuleWithinLoop, "displaysyndicate", false );

                                    if( !IsInstance )
                                    {
                                        //Add new module
                                        intModuleId = objModules.AddModule( objModule );
                                        if( templateModuleID > 0 )
                                        {
                                            hModules.Add( templateModuleID, intModuleId );
                                        }
                                    }
                                    else
                                    {
                                        //Add instance
                                        objModule.ModuleID = Convert.ToInt32( hModules[templateModuleID] );
                                        intModuleId = objModules.AddModule( objModule );
                                    }

                                    if( XmlUtils.GetNodeValue( nodeModuleWithinLoop, "content", "" ) != "" & !IsInstance )
                                    {
                                        objModule = objModules.GetModule( intModuleId, TabId, true );
                                        string strVersion = nodeModule.SelectSingleNode( "content" ).Attributes["version"].Value;
                                        string strType = nodeModule.SelectSingleNode( "content" ).Attributes["type"].Value;
                                        string strcontent = nodeModule.SelectSingleNode( "content" ).InnerXml;
                                        strcontent = strcontent.Substring( 9, strcontent.Length - 12 );
                                        strcontent = HttpContext.Current.Server.HtmlDecode( strcontent );

                                        if( objModule.BusinessControllerClass != "" & objModule.IsPortable )
                                        {
                                            try
                                            {
                                                object objObject = Reflection.CreateObject( objModule.BusinessControllerClass, objModule.BusinessControllerClass );
                                                if( objObject is IPortable )
                                                {
                                                    ( (IPortable)objObject ).ImportModule( objModule.ModuleID, strcontent, strVersion, objportal.AdministratorId );
                                                }
                                            }
                                            catch
                                            {
                                                //ignore errors
                                            }
                                        }
                                    }

                                    // Process permissions only once
                                    if( !IsInstance )
                                    {
                                        XmlNodeList nodeModulePermissions = nodeModule.SelectNodes( "modulepermissions/permission" );
                                        ParseModulePermissions( nodeModulePermissions, PortalId, intModuleId );
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
        private static bool FindModule(XmlNode nodeModule, int tabId, PortalTemplateModuleAction mergeTabs)
        {
            var moduleController = new ModuleController();
            var modules = moduleController.GetTabModules(tabId);

            bool moduleFound = false;
            string modTitle = XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "title");
            if (mergeTabs == PortalTemplateModuleAction.Merge)
            {
                if (modules.Select(kvp => kvp.Value).Any(module => modTitle == module.ModuleTitle))
                {
                    moduleFound = true;
                }
            }
            return moduleFound;
        }
コード例 #20
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        private static void UpgradeToVersion600()
        {
            var tabController = new TabController();

            var hostPages = tabController.GetTabsByPortal(Null.NullInteger);

            //This ensures that all host pages have a tab path.
            //so they can be found later. (DNNPRO-17129)
            foreach (var hostPage in hostPages.Values)
            {
                hostPage.TabPath = Globals.GenerateTabPath(hostPage.ParentId, hostPage.TabName);
                tabController.UpdateTab(hostPage);
            }

            var settings = PortalController.GetCurrentPortalSettings();

            var moduleController = new ModuleController();

            if (settings != null)
            {
                var hostTab = tabController.GetTab(settings.SuperTabId, Null.NullInteger, false);
                hostTab.IsVisible = false;
                tabController.UpdateTab(hostTab);
                foreach (var module in moduleController.GetTabModules(settings.SuperTabId).Values)
                {
                    moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
                }
            }

            //remove timezone editor
            int moduleDefId = GetModuleDefinition("Languages", "Languages");
            RemoveModuleControl(moduleDefId, "TimeZone");

            //6.0 requires the old TimeZone property to be marked as Deleted - Delete for Host
            ProfilePropertyDefinition ppdHostTimeZone = ProfileController.GetPropertyDefinitionByName(Null.NullInteger, "TimeZone");
            if (ppdHostTimeZone != null)
            {
                ProfileController.DeletePropertyDefinition(ppdHostTimeZone);
            }

            var portalController = new PortalController();
            foreach (PortalInfo portal in portalController.GetPortals())
            {
                //update timezoneinfo
#pragma warning disable 612,618
                TimeZoneInfo timeZoneInfo = Localization.Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(portal.TimeZoneOffset);                
#pragma warning restore 612,618
                PortalController.UpdatePortalSetting(portal.PortalID, "TimeZone", timeZoneInfo.Id, false);

                //6.0 requires the old TimeZone property to be marked as Deleted - Delete for Portals
                ProfilePropertyDefinition ppdTimeZone = ProfileController.GetPropertyDefinitionByName(portal.PortalID, "TimeZone");
                if (ppdTimeZone != null)
                {
                    ProfileController.DeletePropertyDefinition(ppdTimeZone);
                }

                var adminTab = tabController.GetTab(portal.AdminTabId, portal.PortalID, false);

                adminTab.IsVisible = false;
                tabController.UpdateTab(adminTab);

                foreach (var module in moduleController.GetTabModules(portal.AdminTabId).Values)
                {
                    moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
                }
            }

            //Ensure that Display Beta Notice setting is present
            var displayBetaNotice = Host.DisplayBetaNotice;
            HostController.Instance.Update("DisplayBetaNotice", displayBetaNotice ? "Y": "N");

            moduleDefId = GetModuleDefinition("Languages", "Languages");
            AddModuleControl(moduleDefId, "EnableContent", "Enable Localized Content", "DesktopModules/Admin/Languages/EnableLocalizedContent.ascx", "", SecurityAccessLevel.Host, 0, null, false);
            AddProfessionalPreviewPages();

            AddDefaultModuleIcons();

            AddIconToAllowedFiles();

            FavIconsToPortalSettings();

            var tab = tabController.GetTabByName("Host", Null.NullInteger, Null.NullInteger);

            if (tab != null)
            {
                RemoveModule("Extensions", "Module Definitions", tab.TabID, true);
                RemoveModule("Marketplace", "Marketplace", tab.TabID, true);
            }
        }
コード例 #21
0
        protected void submitTranslation_Click(object sender, EventArgs e)
        {
            var modCtrl = new ModuleController();
            var tabCtrl = new TabController();

            foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
            {
                //Make Deep copies of all modules
                var moduleCtrl = new ModuleController();
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleCtrl.GetTabModules(Tab.TabID))
                {
                    ModuleInfo sourceModule = kvp.Value;
                    ModuleInfo localizedModule = null;

                    //Make sure module has the correct culture code
                    if (string.IsNullOrEmpty(sourceModule.CultureCode))
                    {
                        sourceModule.CultureCode = Tab.CultureCode;
                        moduleCtrl.UpdateModule(sourceModule);
                    }

                    if (!sourceModule.LocalizedModules.TryGetValue(localizedTab.CultureCode, out localizedModule))
                    {
                        if (!sourceModule.IsDeleted)
                        {
                            //Shallow (Reference Copy)

                            {
                                if (sourceModule.AllTabs)
                                {
                                    foreach (ModuleInfo m in moduleCtrl.GetModuleTabs(sourceModule.ModuleID))
                                    {
                                        //Get the tab
                                        TabInfo allTabsTab = tabCtrl.GetTab(m.TabID, m.PortalID, false);
                                        TabInfo localizedAllTabsTab = null;
                                        if (allTabsTab.LocalizedTabs.TryGetValue(localizedTab.CultureCode, out localizedAllTabsTab))
                                        {
                                            moduleCtrl.CopyModule(m, localizedAllTabsTab, Null.NullString, true);
                                        }
                                    }
                                }
                                else
                                {
                                    moduleCtrl.CopyModule(sourceModule, localizedTab, Null.NullString, true);
                                }
                            }

                            //Fetch new module
                            localizedModule = moduleCtrl.GetModule(sourceModule.ModuleID, localizedTab.TabID);

                            //Convert to deep copy
                            moduleCtrl.LocalizeModule(localizedModule, LocaleController.Instance.GetLocale(localizedTab.CultureCode));
                        }
                    }
                }

                var users = new Dictionary<int, UserInfo>();

                //Give default translators for this language and administrators permissions
                tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);

                //Send Messages to all the translators of new content
                foreach (var translator in users.Values.Where(user => user.UserID != PortalSettings.AdministratorId))
                {
                    AddTranslationSubmittedNotification(localizedTab, translator);
                }
            }

            //Redirect to refresh page (and skinobjects)
            Response.Redirect(Request.RawUrl, true);
        }
コード例 #22
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        private static void UpgradeToVersion610()
        {
            AddModuleCategories();

            //update languages module
            int moduleDefId = GetModuleDefinition("Languages", "Languages");
            AddModuleControl(moduleDefId, "LocalizePages", "Localize Pages", "DesktopModules/Admin/Languages/LocalizePages.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0, Null.NullString, true);

            //add store control
            moduleDefId = AddModuleDefinition("Extensions", "", "Extensions");
            AddModuleControl(moduleDefId, "Store", "Store Details", "DesktopModules/Admin/Extensions/Store.ascx", "~/images/icon_extensions_32px.png", SecurityAccessLevel.Host, 0);

            EnableModalPopUps();

            var tabController = new TabController();
            var tab = tabController.GetTabByName("Portals", Null.NullInteger);
            tab.TabName = "Site Management";
            tabController.UpdateTab(tab);

            var moduleController = new ModuleController();
            foreach (var module in moduleController.GetTabModules(tab.TabID).Values)
            {
                if (module.ModuleTitle == "Portals")
                {
                    module.ModuleTitle = "Site Management";
                    moduleController.UpdateModule(module);
                }
            }

            //Add List module to Admin page of every portal                      
            ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Lists");
            if (mDef != null)
            {
                AddAdminPages("Lists",
                                "Manage common lists",
                                "~/Icons/Sigma/Lists_16X16_Standard.png",
                                "~/Icons/Sigma/Lists_32X32_Standard.png",
                                true,
                                mDef.ModuleDefID,
                                "Lists",
                                "~/Icons/Sigma/Lists_16X16_Standard.png",
                                true);
            }

			//update DotNetNuke.Portals' friend name to 'Sites'.
        	var portalPackage = PackageController.GetPackageByName("DotNetNuke.Portals");
			if(portalPackage != null)
			{
				portalPackage.FriendlyName = "Sites";
				PackageController.SavePackage(portalPackage);
			}

			//add mobile preview control
			AddModuleControl(Null.NullInteger, "MobilePreview", "Mobile Preview", "DesktopModules/Admin/MobilePreview/Preview.ascx", string.Empty, SecurityAccessLevel.Admin, Null.NullInteger);
        }
コード例 #23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   UpdateWorkFlow updates the currently active Workflow
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="WorkFlowType">The type of workflow (Module | Page | Site)</param>
        /// <param name = "WorkflowID">The ID of the Workflow</param>
        /// <param name="ObjectID">The ID of the object to apply the update to (depends on WorkFlowType)</param>
        /// <param name="ReplaceExistingSettings">Should existing settings be overwritten?</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void UpdateWorkflow(int ObjectID, string WorkFlowType, int WorkflowID, bool ReplaceExistingSettings)
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();

            switch (WorkFlowType)
            {
                case "Module":
                    moduleController.UpdateModuleSetting(ObjectID, "WorkflowID", WorkflowID.ToString());
                    break;
                case "Page":
                    tabController.UpdateTabSetting(ObjectID, "WorkflowID", WorkflowID.ToString());
                    if (ReplaceExistingSettings)
                    {
                        //Get All Modules on the current Tab
                        foreach (var kvp in moduleController.GetTabModules(ObjectID))
                        {
                            ClearModuleSettings(kvp.Value);
                        }
                    }
                    break;
                case "Site":
                    PortalController.UpdatePortalSetting(ObjectID, "WorkflowID", WorkflowID.ToString());
                    if (ReplaceExistingSettings)
                    {
                        //Get All Tabs aon the Site
                        foreach (var kvp in tabController.GetTabsByPortal(ObjectID))
                        {
                            tabController.DeleteTabSetting(kvp.Value.TabID, "WorkFlowID");
                        }
                        //Get All Modules in the current Site
                        foreach (ModuleInfo objModule in moduleController.GetModules(ObjectID))
                        {
                            ClearModuleSettings(objModule);
                        }
                    }
                    break;
            }
        }
コード例 #24
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
 private static void UpgradeToVersion621()
 {
     //update administrators' role description.
     var portalController = new PortalController();
     var moduleController = new ModuleController();
     foreach (PortalInfo portal in portalController.GetPortals())
     {
         //update about me's template
         var myProfileTabId = TabController.GetTabByTabPath(portal.PortalID, "//ActivityFeed//MyProfile", string.Empty);
         if (myProfileTabId != Null.NullInteger)
         {
             var tabModules = moduleController.GetTabModules(myProfileTabId);
             foreach (var module in tabModules.Values)
             {
                 var settings = moduleController.GetTabModuleSettings(module.TabModuleID);
                 if (settings.ContainsKey("ProfileTemplate") && settings["ProfileTemplate"].ToString().Contains("<div class=\"pBio\">"))
                 {
                     var template = @"<div class=""pBio"">
                             <h3 data-bind=""text: AboutMeText""></h3>
                             <span data-bind=""text: EmptyAboutMeText, visible: Biography().length==0""></span>
                             <p data-bind=""html: Biography""></p>
                             </div>
                             <div class=""pAddress"">
                             <h3 data-bind=""text: LocationText""></h3>
                             <span data-bind=""text: EmptyLocationText, visible: Street().length=0 && Location().length==0 && Country().length==0 && PostalCode().length==0""></span>
                             <p><span data-bind=""text: Street()""></span><span data-bind=""visible: Street().length > 0""><br/></span>
                             <span data-bind=""text: Location()""></span><span data-bind=""visible: Location().length > 0""><br/></span>
                             <span data-bind=""text: Country()""></span><span data-bind=""visible: Country().length > 0""><br/></span>
                             <span data-bind=""text: PostalCode()""></span>
                             </p>
                             </div>
                             <div class=""pContact"">
                             <h3 data-bind=""text: GetInTouchText""></h3>
                             <span data-bind=""text: EmptyGetInTouchText, visible: Telephone().length==0 && Email().length==0 && Website().length==0 && IM().length==0""></span>
                             <ul>
                             <li data-bind=""visible: Telephone().length > 0""><strong><span data-bind=""text: TelephoneText"">:</span></strong> <span data-bind=""text: Telephone()""></span></li>
                             <li data-bind=""visible: Email().length > 0""><strong><span data-bind=""text: EmailText"">:</span></strong> <span data-bind=""text: Email()""></span></li>
                             <li data-bind=""visible: Website().length > 0""><strong><span data-bind=""text: WebsiteText"">:</span></strong> <span data-bind=""text: Website()""></span></li>
                             <li data-bind=""visible: IM().length > 0""><strong><span data-bind=""text: IMText"">:</span></strong> <span data-bind=""text: IM()""></span></li>
                             </ul>
                             </div>
                             <div class=""dnnClear""></div>";
                     moduleController.UpdateTabModuleSetting(module.TabModuleID, "ProfileTemplate", template);
                 }
             }
         }
     }
 }
コード例 #25
0
        private static Dictionary<int, string> GetTabModules(int tabID)
        {
            var tabCtrl = new TabController();
            var moduleCtrl = new ModuleController();
            var tabModules = moduleCtrl.GetTabModules(tabID);

            // Is this tab from another site?
            var isRemote = tabCtrl.GetTab(tabID, Null.NullInteger, false).PortalID != PortalSettings.Current.PortalId;

            var pageModules = tabModules.Values.Where(m => !isRemote || ModuleSuportsSharing(m)).Where(m => ModulePermissionController.CanAdminModule(m) && m.IsDeleted == false).ToList();

            return pageModules.ToDictionary(module => module.ModuleID, module => module.ModuleTitle);
        }
コード例 #26
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        private static void ReplaceMessagingModule()
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "ReplaceMessagingModule");
            var portalController = new PortalController();
            var moduleController = new ModuleController();
            var tabController = new TabController();

            var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center");
            if (moduleDefinition == null) return;

            var portals = portalController.GetPortals();
            foreach (PortalInfo portal in portals)
            {
                if (portal.UserTabId > Null.NullInteger)
                {
                    //Find TabInfo
                    TabInfo tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true);
                    if (tab != null)
                    {
                        //Add new module to the page
                        AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true);
                    }

                    foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(portal.UserTabId))
                    {
                        var module = kvp.Value;
                        if (module.DesktopModule.FriendlyName == "Messaging")
                        {
                            //Delete the Module from the Modules list
                            moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
                            break;
                        }
                    }
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// Renders the tab node.
        /// </summary>
        /// <param name="parentNode">The parent node.</param>
        /// <param name="tabInfo">The tab info.</param>
        /// <param name="moduleController">The module controller.</param>
        /// <param name="editorHostSettings">The editor host settings.</param>
        private void RenderTabNode(
            TreeNode parentNode,
            TabInfo tabInfo,
            ModuleController moduleController,
            List<EditorHostSetting> editorHostSettings)
        {
            var tabKey = string.Format("DNNCKT#{0}#", tabInfo.TabID);

            var tabSettingsExists = SettingsUtil.CheckExistsPortalOrPageSettings(editorHostSettings, tabKey);

            // Tabs
            var tabNode = new TreeNode
                              {
                                  Text = tabInfo.TabName,
                                  Value = string.Format("t{0}", tabInfo.TabID),
                                  ImageUrl =
                                      tabSettingsExists
                                          ? "../images/PageHasSetting.png"
                                          : "../images/PageNoSetting.png"
                              };

            if (tabInfo.HasChildren)
            {
                foreach (var childTab in TabController.GetTabsByParent(tabInfo.TabID, tabInfo.PortalID))
                {
                    this.RenderTabNode(tabNode, childTab, moduleController, editorHostSettings);
                }
            }

            var modules = moduleController.GetTabModules(tabInfo.TabID).Values;

            foreach (var moduleNode in from moduleInfo in modules
                                       let moduleKey = string.Format("DNNCKMI#{0}#INS#", moduleInfo.ModuleID)
                                       let moduleSettingsExists =
                                           SettingsUtil.CheckExistsModuleSettings(moduleKey, moduleInfo.ModuleID)
                                       select
                                           new TreeNode
                                               {
                                                   Text = moduleInfo.ModuleTitle,
                                                   ImageUrl =
                                                       moduleSettingsExists
                                                           ? "../images/ModuleHasSetting.png"
                                                           : "../images/ModuleNoSetting.png",
                                                   Value = string.Format("m{0}", moduleInfo.ModuleID)
                                               })
            {
                tabNode.ChildNodes.Add(moduleNode);
            }

            parentNode.ChildNodes.Add(tabNode);
        }
コード例 #28
0
ファイル: Upgrade.cs プロジェクト: ryanmalone/BGDNNWEB
        ///-----------------------------------------------------------------------------
        ///<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)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddModuleToPage:" + moduleDefId);
            var moduleController = new ModuleController();
            ModuleInfo moduleInfo;
            int moduleId = Null.NullInteger;

            if ((page != null))
            {
                bool isDuplicate = false;
                foreach (var kvp in moduleController.GetTabModules(page.TabID))
                {
                    moduleInfo = kvp.Value;
                    if (moduleInfo.ModuleDefID == moduleDefId)
                    {
                        isDuplicate = true;
                        moduleId = moduleInfo.ModuleID;
                    }
                }

                if (!isDuplicate)
                {
                    moduleInfo = new ModuleInfo
                                     {
                                         ModuleID = Null.NullInteger,
                                         PortalID = page.PortalID,
                                         TabID = page.TabID,
                                         ModuleOrder = -1,
                                         ModuleTitle = moduleTitle,
                                         PaneName = Globals.glbDefaultPane,
                                         ModuleDefID = moduleDefId,
                                         CacheTime = 0,
                                         IconFile = moduleIconFile,
                                         AllTabs = false,
                                         Visibility = VisibilityState.None,
                                         InheritViewPermissions = inheritPermissions
                                     };

                    try
                    {
                        moduleId = moduleController.AddModule(moduleInfo);
                    }
                    catch (Exception exc)
                    {
                        Logger.Error(exc);
						DnnInstallLogger.InstallLogError(exc);
                    }
                }
            }
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogEnd", Localization.Localization.GlobalResourceFile) + "AddModuleToPage:" + moduleDefId);
            return moduleId;
        }
コード例 #29
0
        private int FindMessageTab()
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();

            //On brand new install the new Message Center Module is on the child page of User Profile Page 
            //On Upgrade to 6.2.0, the Message Center module is on the User Profile Page
            var profileTab = tabController.GetTab(PortalSettings.UserTabId, PortalSettings.PortalId, false);
            if (profileTab != null)
            {
                var childTabs = tabController.GetTabsByPortal(profileTab.PortalID).DescendentsOf(profileTab.TabID);
                foreach (TabInfo tab in childTabs)
                {
                    foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
                    {
                        var module = kvp.Value;
                        if (module.DesktopModule.FriendlyName == "Message Center" && !module.IsDeleted)
                        {
                            return tab.TabID;                            
                        }
                    }
                }
            }

            //default to User Profile Page
            return PortalSettings.UserTabId;            
        }
コード例 #30
0
	    private void DeleteTab(TabInfo tab, bool deleteDescendants)
		{
			var eventLogController = new EventLogController();
			var tabController = new TabController();
			var moduleController = new ModuleController();

			//get tab modules before deleting page
			var tabModules = moduleController.GetTabModules(tab.TabID);

			//hard delete the tab
			tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants);
			
			//delete modules that do not have other instances
			foreach (var kvp in tabModules)
			{
				//check if all modules instances have been deleted
				var delModule = moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false);
				if (delModule == null || delModule.TabID == Null.NullInteger)
				{
					moduleController.DeleteModule(kvp.Value.ModuleID);
				}
			}
			eventLogController.AddLog(tab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_DELETED);
		}