Ejemplo n.º 1
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 );
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// UpgradeApplication - This overload is used for general application upgrade operations.
        /// </summary>
        /// <remarks>
        ///	Since it is not version specific and is invoked whenever the application is
        ///	restarted, the operations must be re-executable.
        /// </remarks>
        private static string UpgradeApplication()
        {
            string strExceptions = "";

            try
            {
                // remove the system message module from the admin tab
                // System Messages are now managed through Localization
                if (CoreModuleExists("System Messages"))
                {
                    RemoveCoreModule("System Messages", "Admin", "Site Settings", false);
                }

                // add the log viewer module to the admin tab
                int moduleDefId;
                if (CoreModuleExists("Log Viewer") == false)
                {
                    moduleDefId = AddModuleDefinition("Log Viewer", "Allows you to view log entries for portal events.", "Log Viewer");
                    AddModuleControl(moduleDefId, "", "", "Admin/Logging/LogViewer.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "Edit", "Edit Log Settings", "Admin/Logging/EditLogTypes.ascx", "", SecurityAccessLevel.Host, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Log Viewer", "icon_viewstats_16px.gif", true, moduleDefId, "Log Viewer", "icon_viewstats_16px.gif");
                }

                if (CoreModuleExists("Authentication") == false)
                {
                    moduleDefId = AddModuleDefinition("Windows Authentication", "Allows you to manage authentication settings for sites using Windows Authentication.", "Windows Authentication");
                    AddModuleControl(moduleDefId, "", "", "Admin/Security/AuthenticationSettings.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Authentication", "icon_authentication_16px.gif", true, moduleDefId, "Authentication", "icon_authentication_16px.gif");
                }

                // add the schedule module to the host tab
                TabInfo newPage;
                if (CoreModuleExists("Schedule") == false)
                {
                    moduleDefId = AddModuleDefinition("Schedule", "Allows you to schedule tasks to be run at specified intervals.", "Schedule");
                    AddModuleControl(moduleDefId, "", "", "Admin/Scheduling/ViewSchedule.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "Edit", "Edit Schedule", "Admin/Scheduling/EditSchedule.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "History", "Schedule History", "Admin/Scheduling/ViewScheduleHistory.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Status", "Schedule Status", "Admin/Scheduling/ViewScheduleStatus.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Schedule", "icon_scheduler_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Schedule", "icon_scheduler_16px.gif");
                }

                // add the skins module to the admin tab
                if (CoreModuleExists("Skins") == false)
                {
                    moduleDefId = AddModuleDefinition("Skins", "Allows you to manage your skins and containers.", "Skins");
                    AddModuleControl(moduleDefId, "", "", "Admin/Skins/EditSkins.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Skins", "icon_skins_16px.gif", true, moduleDefId, "Skins", "icon_skins_16px.gif");
                }

                // add the language editor module to the host tab
                if (!CoreModuleExists("Languages"))
                {
                    moduleDefId = AddModuleDefinition("Languages", "The Super User can manage the suported languages installed on the system.", "Languages");
                    AddModuleControl(moduleDefId, "", "", "Admin/Localization/Languages.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "TimeZone", "TimeZone Editor", "Admin/Localization/TimeZoneEditor.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Language", "Language Editor", "Admin/Localization/LanguageEditor.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "FullEditor", "Language Editor", "Admin/Localization/LanguageEditorExt.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Verify", "Resource File Verifier", "Admin/Localization/ResourceVerifier.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Package", "Create Language Pack", "Admin/Localization/LanguagePack.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Languages", "icon_language_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Languages", "icon_language_16px.gif");

                    moduleDefId = AddModuleDefinition("Custom Locales", "Administrator can manage custom translations for portal.", "Custom Portal Locale");
                    AddModuleControl(moduleDefId, "", "", "Admin/Localization/LanguageEditor.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "FullEditor", "Language Editor", "Admin/Localization/LanguageEditorExt.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Languages", "icon_language_16px.gif", true, moduleDefId, "Languages", "icon_language_16px.gif");
                }

                // add the Search Admin module to the host tab
                if (CoreModuleExists("Search Admin") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Admin", "The Search Admininstrator provides the ability to manage search settings.", "Search Admin");
                    AddModuleControl(moduleDefId, "", "", "Admin/Search/SearchAdmin.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Search Admin", "icon_search_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Search Admin", "icon_search_16px.gif");

                    //Add the Module/Page to all configured portals
                    //AddAdminPages("Search Admin", "icon_search_16px.gif", True, ModuleDefID, "Search Admin", "icon_search_16px.gif")
                }

                // add the Search Input module
                if (CoreModuleExists("Search Input") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Input", "The Search Input module provides the ability to submit a search to a given search results module.", "Search Input", false, false);
                    AddModuleControl(moduleDefId, "", "", "DesktopModules/SearchInput/SearchInput.ascx", "", SecurityAccessLevel.Anonymous, 0);
                    AddModuleControl(moduleDefId, "Settings", "Search Input Settings", "DesktopModules/SearchInput/Settings.ascx", "", SecurityAccessLevel.Edit, 0);
                }

                // add the Search Results module
                if (CoreModuleExists("Search Results") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Results", "The Search Reasults module provides the ability to display search results.", "Search Results", false, false);
                    AddModuleControl(moduleDefId, "", "", "DesktopModules/SearchResults/SearchResults.ascx", "", SecurityAccessLevel.Anonymous, 0);
                    AddModuleControl(moduleDefId, "Settings", "Search Results Settings", "DesktopModules/SearchResults/Settings.ascx", "", SecurityAccessLevel.Edit, 0);

                    //Add the Search Module/Page to all configured portals
                    AddSearchResults(moduleDefId);
                }

                // add the site wizard module to the admin tab 
                if (CoreModuleExists("Site Wizard") == false)
                {
                    moduleDefId = AddModuleDefinition("Site Wizard", "The Administrator can use this user-friendly wizard to set up the common features of the Portal/Site.", "Site Wizard");
                    AddModuleControl(moduleDefId, "", "", "Admin/Portal/Sitewizard.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddAdminPages("Site Wizard", "icon_sitesettings_16px.gif", true, moduleDefId, "Site Wizard", "icon_sitesettings_16px.gif");
                }

                // add portal alias module
                if (CoreModuleExists("Portal Aliases") == false)
                {
                    moduleDefId = AddModuleDefinition("Portal Aliases", "Allows you to view portal aliases.", "Portal Aliases");
                    AddModuleControl(moduleDefId, "", "", "Admin/Portal/PortalAlias.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Edit", "Portal Aliases", "Admin/Portal/EditPortalAlias.ascx", "", SecurityAccessLevel.Host, 0);

                    //Add the Module/Page to all configured portals (with InheritViewPermissions = False)
                    AddAdminPages("Site Settings", "icon_sitesettings_16px.gif", false, moduleDefId, "Portal Aliases", "icon_sitesettings_16px.gif", false);
                }

                //add Lists module and tab
                if (HostTabExists("Lists") == false)
                {
                    moduleDefId = AddModuleDefinition("Lists", "Allows you to edit common lists.", "Lists");
                    AddModuleControl(moduleDefId, "", "", "Admin/Lists/ListEditor.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Lists", "icon_lists_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Lists", "icon_lists_16px.gif");
                }

                // add the feedback settings control
                if (CoreModuleExists("Feedback"))
                {
                    moduleDefId = GetModuleDefinition("Feedback", "Feedback");
                    AddModuleControl(moduleDefId, "Settings", "Feedback Settings", "DesktopModules/Feedback/Settings.ascx", "", SecurityAccessLevel.Edit, 0);
                }

                if (HostTabExists("Superuser Accounts") == false)
                {
                    //add SuperUser Accounts module and tab
                    DesktopModuleController objDesktopModuleController = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModuleInfo;
                    objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName("User Accounts");
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                    moduleDefId = objModuleDefController.GetModuleDefinitionByName(objDesktopModuleInfo.DesktopModuleID, "User Accounts").ModuleDefID;

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Superuser Accounts", "icon_users_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Superuser Accounts", "icon_users_32px.gif");
                }

                //add Skins module and tab to Host menu
                if (HostTabExists("Skins") == false)
                {
                    DesktopModuleController objDesktopModuleController = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModuleInfo;
                    objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName("Skins");
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                    moduleDefId = objModuleDefController.GetModuleDefinitionByName(objDesktopModuleInfo.DesktopModuleID, "Skins").ModuleDefID;

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Skins", "icon_skins_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Skins", "");
                }

                //Add Search Skin Object
                AddModuleControl(Null.NullInteger, "SEARCH", Null.NullString, "Admin/Skins/Search.ascx", "", SecurityAccessLevel.SkinObject, Null.NullInteger);

                //Add TreeView Skin Object
                AddModuleControl(Null.NullInteger, "TREEVIEW", Null.NullString, "Admin/Skins/TreeViewMenu.ascx", "", SecurityAccessLevel.SkinObject, Null.NullInteger);

                //Add Private Assembly Packager
                moduleDefId = GetModuleDefinition("Module Definitions", "Module Definitions");
                AddModuleControl(moduleDefId, "Package", "Create Private Assembly", "Admin/ModuleDefinitions/PrivateAssembly.ascx", "icon_moduledefinitions_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);

                //Add Edit Role Groups
                moduleDefId = GetModuleDefinition("Security Roles", "Security Roles");
                AddModuleControl(moduleDefId, "EditGroup", "Edit Role Groups", "Admin/Security/EditGroups.ascx", "icon_securityroles_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "Admin/Users/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger);

                //Add User Accounts Controls
                moduleDefId = GetModuleDefinition("User Accounts", "User Accounts");
                AddModuleControl(moduleDefId, "ManageProfile", "Manage Profile Definition", "Admin/Users/ProfileDefinitions.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "EditProfileProperty", "Edit Profile Property Definition", "Admin/Users/EditProfileDefinition.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "Admin/Users/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "Profile", "Profile", "Admin/Users/ManageUsers.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "SendPassword", "Send Password", "Admin/Security/SendPassword.ascx", "", SecurityAccessLevel.Anonymous, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "ViewProfile", "View Profile", "Admin/Users/ViewProfile.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger);

                //Update Child Portal subHost.aspx
                PortalAliasController objAliasController = new PortalAliasController();
                ArrayList arrAliases = objAliasController.GetPortalAliasArrayByPortalID(Null.NullInteger);

                foreach (PortalAliasInfo objAlias in arrAliases)
                {
                    //For the alias to be for a child it must be of the form ...../child
                    if (objAlias.HTTPAlias.LastIndexOf("/") != -1)
                    {
                        string childPath = Globals.ApplicationMapPath + "\\" + objAlias.HTTPAlias.Substring(objAlias.HTTPAlias.LastIndexOf("/") + 1);
                        if (Directory.Exists(childPath))
                        {
                            //Folder exists App/child so upgrade

                            //Rename existing file
                            File.Copy(childPath + "\\" + Globals.glbDefaultPage, childPath + "\\old_" + Globals.glbDefaultPage, true);

                            // create the subhost default.aspx file
                            File.Copy(Globals.HostMapPath + "subhost.aspx", childPath + "\\" + Globals.glbDefaultPage, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strExceptions += "Error: " + ex.Message + "\r\n";
                try
                {
                    Exceptions.Exceptions.LogException(ex);
                }
                catch
                {
                    // ignore
                }
            }

            return strExceptions;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// AddModuleDefinition adds a new Core Module Definition to the system
        /// </summary>
        /// <remarks>
        ///	This overload allows the caller to determine whether the module has a controller
        /// class
        /// </remarks>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Add</param>
        ///	<param name="Description">Description of the Module</param>
        ///	<param name="ModuleDefinitionName">The Module Definition Name</param>
        ///	<param name="Premium">A flag representing whether the module is a Premium module</param>
        ///	<param name="Admin">A flag representing whether the module is an Admin module</param>
        ///	<param name="Controller">The Controller Class string</param>
        ///	<param name="Version">The Module Version</param>
        ///	<returns>The Module Definition Id of the new Module</returns>
        /// <history>
        /// 	[cnurse]	10/14/2004	documented
        ///     [cnurse]    11/11/2004  removed addition of Module Control (now in AddMOduleControl)
        /// </history>
        private static int AddModuleDefinition(string DesktopModuleName, string Description, string ModuleDefinitionName, bool Premium, bool Admin, string Controller, string Version)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // check if desktop module exists
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByName(DesktopModuleName);
            if (objDesktopModule == null)
            {
                objDesktopModule = new DesktopModuleInfo();

                objDesktopModule.DesktopModuleID = Null.NullInteger;
                objDesktopModule.FriendlyName = DesktopModuleName;
                objDesktopModule.FolderName = DesktopModuleName;
                objDesktopModule.ModuleName = DesktopModuleName;
                objDesktopModule.Description = Description;
                objDesktopModule.Version = Version;
                objDesktopModule.IsPremium = Premium;
                objDesktopModule.IsAdmin = Admin;
                objDesktopModule.BusinessControllerClass = Controller;

                objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
            }

            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

            // check if module definition exists
            ModuleDefinitionInfo objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, ModuleDefinitionName);
            if (objModuleDefinition == null)
            {
                objModuleDefinition = new ModuleDefinitionInfo();

                objModuleDefinition.ModuleDefID = Null.NullInteger;
                objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                objModuleDefinition.FriendlyName = ModuleDefinitionName;

                objModuleDefinition.ModuleDefID = objModuleDefinitions.AddModuleDefinition(objModuleDefinition);
            }

            return objModuleDefinition.ModuleDefID;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// GetModuleDefinition gets the Module Definition Id of a module
        /// </summary>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Add</param>
        ///	<param name="ModuleDefinitionName">The Module Definition Name</param>
        ///	<returns>The Module Definition Id of the Module (-1 if no module definition)</returns>
        private static int GetModuleDefinition(string DesktopModuleName, string ModuleDefinitionName)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // get desktop module
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByName(DesktopModuleName);
            if (objDesktopModule == null)
            {
                return -1;
            }

            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

            // get module definition
            ModuleDefinitionInfo objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, ModuleDefinitionName);
            if (objModuleDefinition == null)
            {
                return -1;
            }

            return objModuleDefinition.ModuleDefID;
        }
        private static void GenerateAdminTab(int PortalId)
        {
            var tabID = TabController.GetTabByTabPath(PortalId, @"//Admin//OpenUrlRewriter", Null.NullString);
            if (tabID == Null.NullInteger)
            {
                var adminTabID = TabController.GetTabByTabPath(PortalId, @"//Admin", Null.NullString);

                /* dont work on dnn 7 -  generate new section "SEO Features" in admin menu

                var tabName = "SEO Features";
                var tabPath = Globals.GenerateTabPath(adminTabID, tabName);
                tabID = TabController.GetTabByTabPath(PortalId, tabPath, Null.NullString);
                if (tabID == Null.NullInteger)
                {
                    //Create a new page
                    var newParentTab = new TabInfo();
                    newParentTab.TabName = tabName;
                    newParentTab.ParentId = adminTabID;
                    newParentTab.PortalID = PortalId;
                    newParentTab.IsVisible = true;
                    newParentTab.DisableLink = true;
                    newParentTab.TabID = new TabController().AddTab(newParentTab);
                    tabID = newParentTab.TabID;
                }
                 */

                // create new page "Url Rules Cache"
                int parentTabID = adminTabID;
                var tabName = "Open Url Rewriter";
                var tabPath = Globals.GenerateTabPath(parentTabID, tabName);
                tabID = TabController.GetTabByTabPath(PortalId, tabPath, Null.NullString);
                if (tabID == Null.NullInteger)
                {
                    //Create a new page
                    var newTab = new TabInfo();
                    newTab.TabName = tabName;
                    newTab.ParentId = parentTabID;
                    newTab.PortalID = PortalId;
                    newTab.IsVisible = true;
            #if DNN71
                    newTab.IconFile = "~/Icons/Sigma/AdvancedUrlMngmt_16x16.png";
                    newTab.IconFileLarge = "~/Icons/Sigma/AdvancedUrlMngmt_32x32.png";
            #else
                    newTab.IconFile = "~/Images/icon_search_16px.gif";
                    newTab.IconFileLarge = "~/Images/icon_search_32px.gif";
            #endif
                    newTab.TabID = new TabController().AddTab(newTab, false);
                    tabID = newTab.TabID;

                }
            }
            // create new module "OpenUrlRewriter"
            var moduleCtl = new ModuleController();
            if (moduleCtl.GetTabModules(tabID).Count == 0)
            {
                var dmc = new DesktopModuleController();
                var dm = dmc.GetDesktopModuleByModuleName("OpenUrlRewriter");
                var mdc = new ModuleDefinitionController();
                var md = mdc.GetModuleDefinitionByName(dm.DesktopModuleID, "OpenUrlRewriter");

                var objModule = new ModuleInfo();
                //objModule.Initialize(PortalId);
                objModule.PortalID = PortalId;
                objModule.TabID = tabID;
                objModule.ModuleOrder = Null.NullInteger;
                objModule.ModuleTitle = "Open Url Rewriter";
                objModule.PaneName = Globals.glbDefaultPane;
                objModule.ModuleDefID = md.ModuleDefID;
                objModule.InheritViewPermissions = true;
                objModule.AllTabs = false;
            #if DNN71
                objModule.IconFile = "~/Icons/Sigma/AdvancedUrlMngmt_16x16.png";
            #else
                objModule.IconFile = "~/Images/icon_search_32px.gif";
            #endif
                moduleCtl.AddModule(objModule);
            }
        }