Ejemplo n.º 1
0
        public void MustHaveEmptyHelpUrlForHtmlModule()
        {
            var control = ModuleControlController.GetModuleControlByControlKey("", 111);

            control.HelpURL = "";
            ModuleControlController.UpdateModuleControl(control);
        }
Ejemplo n.º 2
0
        public static bool IsLegacyUI(int moduleId, string key, int portalId)
        {
            var request    = HttpContext.Current.Request;
            var isLegacyUi = true;
            var settings   = PortalController.GetCurrentPortalSettings();

            if (settings != null)
            {
                isLegacyUi = !(settings.EnablePopUps && !request.Browser.Crawler && request.Browser.EcmaScriptVersion >= new Version(1, 0));

                if (!isLegacyUi && !String.IsNullOrEmpty(key))
                {
                    var slaveModule = GetSlaveModule(moduleId, key, settings.ActiveTab.TabID);
                    if (slaveModule != null)
                    {
                        var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID) ??
                                            ModuleControlController.GetModuleControlByControlKey(key, Null.NullInteger);
                        if (moduleControl != null)
                        {
                            isLegacyUi = !moduleControl.SupportsPopUps;
                        }
                    }
                }
            }

            return(isLegacyUi);
        }
Ejemplo n.º 3
0
        private void RemoveModuleControls(IEnumerable <string> controls)
        {
            logger.LogStep("08.--.--", "RemoveModuleControlls - Start", false);

            var desktopModuleNames = new[] { "2sxc", "2sxc-app" };

            // Remove settings and settingswrapper control
            foreach (var d in desktopModuleNames)
            {
                var dmi = DesktopModuleController.GetDesktopModuleByModuleName(d, -1);
                if (dmi != null)
                {
                    var mdi = dmi.ModuleDefinitions.FirstOrDefault();

                    if (mdi.Value != null)
                    {
                        foreach (var c in controls)
                        {
                            var settingsControl = ModuleControlController.GetModuleControlByControlKey(c, mdi.Value.ModuleDefID);
                            if (settingsControl != null)
                            {
                                ModuleControlController.DeleteModuleControl(settingsControl.ModuleControlID);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private string getModulePath(int moduleid, int tabid, string controlKey)
        {
            string path = String.Empty;

            try
            {
                ModuleController        mc  = new ModuleController();
                ModuleControlController mcc = new ModuleControlController();

                ModuleInfo mi = mc.GetModule(moduleid, tabid);
                if (mi != null)
                {
                    var mControl = ModuleControlController.GetModuleControlByControlKey(controlKey, mi.ModuleDefID);
                    if (mControl != null)
                    {
                        path = "~/" + mControl.ControlSrc;
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
            return(path);
        }
Ejemplo n.º 5
0
        private bool ProcessSlaveModule()
        {
            var success     = true;
            var key         = UIUtilities.GetControlKey();
            var moduleId    = UIUtilities.GetModuleId(key);
            var slaveModule = UIUtilities.GetSlaveModule(moduleId, key, this.PortalSettings.ActiveTab.TabID);

            Pane pane;

            this.Panes.TryGetValue(Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            slaveModule.PaneName     = Globals.glbDefaultPane;
            slaveModule.ContainerSrc = this.PortalSettings.ActiveTab.ContainerSrc;
            if (string.IsNullOrEmpty(slaveModule.ContainerSrc))
            {
                slaveModule.ContainerSrc = this.PortalSettings.DefaultPortalContainer;
            }

            slaveModule.ContainerSrc  = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, this.PortalSettings);
            slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);

            var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);

            if (moduleControl != null)
            {
                slaveModule.ModuleControlId = moduleControl.ModuleControlID;
                slaveModule.IconFile        = moduleControl.IconFile;

                string permissionKey;
                switch (slaveModule.ModuleControl.ControlSrc)
                {
                case "Admin/Modules/ModuleSettings.ascx":
                    permissionKey = "MANAGE";
                    break;

                case "Admin/Modules/Import.ascx":
                    permissionKey = "IMPORT";
                    break;

                case "Admin/Modules/Export.ascx":
                    permissionKey = "EXPORT";
                    break;

                default:
                    permissionKey = "CONTENT";
                    break;
                }

                if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, permissionKey, slaveModule))
                {
                    success = this.InjectModule(pane, slaveModule);
                }
                else
                {
                    this.Response.Redirect(Globals.AccessDeniedURL(Localization.GetString("ModuleAccess.Error")), true);
                }
            }

            return(success);
        }
Ejemplo n.º 6
0
        public void MustHaveHelpUrlFilledOutForHtmlModule()
        {
            var moduleDefId = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Text/HTML").ModuleDefID;
            var control     = ModuleControlController.GetModuleControlByControlKey("", moduleDefId);

            control.HelpURL = "http://hive.dotnetnuke.com/Default.aspx?tabid=283";
            ModuleControlController.UpdateModuleControl(control);
        }
Ejemplo n.º 7
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            jQuery.RequestDnnPluginsRegistration();

            var objModules = new ModuleController();
            ModuleControlInfo objModuleControlInfo;

            //get ModuleId
            if ((Request.QueryString["ModuleId"] != null))
            {
                _moduleId = Int32.Parse(Request.QueryString["ModuleId"]);
            }
            if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger)
            {
                //This tab does not have a valid ContentItem
                objModules.CreateContentItem(Module);

                objModules.UpdateModule(Module);
            }

            //Verify that the current user has access to edit this module
            if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Module))
            {
                Response.Redirect(Globals.AccessDeniedURL(), true);
            }
            if (Module != null)
            {
                //get module
                TabModuleId = Module.TabModuleID;

                //get Settings Control
                objModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);

                if (objModuleControlInfo != null)
                {
                    _control = ControlUtilities.LoadControl <Control>(Page, objModuleControlInfo.ControlSrc);

                    var settingsControl = _control as ISettingsControl;
                    if (settingsControl != null)
                    {
                        //Set ID
                        _control.ID = Path.GetFileNameWithoutExtension(objModuleControlInfo.ControlSrc).Replace('.', '-');

                        //add module settings
                        settingsControl.ModuleContext.Configuration = Module;

                        hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings", settingsControl.LocalResourceFile);
                        if (String.IsNullOrEmpty(hlSpecificSettings.Text))
                        {
                            hlSpecificSettings.Text = String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile), Module.DesktopModule.FriendlyName);
                        }
                        pnlSpecific.Controls.Add(_control);
                    }
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// SaveModuleDefinition saves the Module Definition to the database
        /// </summary>
        /// <param name="moduleDefinition">The Module Definition to save</param>
        /// <param name="saveChildren">A flag that determines whether the child objects are also saved</param>
        /// <param name="clearCache">A flag that determines whether to clear the host cache</param>
        /// <history>
        ///     [cnurse]	01/14/2008   Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int SaveModuleDefinition(ModuleDefinitionInfo moduleDefinition, bool saveChildren, bool clearCache)
        {
            int moduleDefinitionID = moduleDefinition.ModuleDefID;

            if (moduleDefinitionID == Null.NullInteger)
            {
                //Add new Module Definition
                moduleDefinitionID = dataProvider.AddModuleDefinition(moduleDefinition.DesktopModuleID,
                                                                      moduleDefinition.FriendlyName,
                                                                      moduleDefinition.DefinitionName,
                                                                      moduleDefinition.DefaultCacheTime,
                                                                      UserController.GetCurrentUserInfo().UserID);
            }
            else
            {
                //Upgrade Module Definition
                dataProvider.UpdateModuleDefinition(moduleDefinition.ModuleDefID, moduleDefinition.FriendlyName, moduleDefinition.DefinitionName, moduleDefinition.DefaultCacheTime, UserController.GetCurrentUserInfo().UserID);
            }
            if (saveChildren)
            {
                foreach (KeyValuePair <string, PermissionInfo> kvp in moduleDefinition.Permissions)
                {
                    kvp.Value.ModuleDefID = moduleDefinitionID;

                    //check if permission exists
                    var       permissionController = new PermissionController();
                    ArrayList permissions          = permissionController.GetPermissionByCodeAndKey(kvp.Value.PermissionCode, kvp.Value.PermissionKey);
                    if (permissions != null && permissions.Count == 1)
                    {
                        var permission = (PermissionInfo)permissions[0];
                        kvp.Value.PermissionID = permission.PermissionID;
                        permissionController.UpdatePermission(kvp.Value);
                    }
                    else
                    {
                        permissionController.AddPermission(kvp.Value);
                    }
                }
                foreach (KeyValuePair <string, ModuleControlInfo> kvp in moduleDefinition.ModuleControls)
                {
                    kvp.Value.ModuleDefID = moduleDefinitionID;

                    //check if definition exists
                    ModuleControlInfo moduleControl = ModuleControlController.GetModuleControlByControlKey(kvp.Value.ControlKey, kvp.Value.ModuleDefID);
                    if (moduleControl != null)
                    {
                        kvp.Value.ModuleControlID = moduleControl.ModuleControlID;
                    }
                    ModuleControlController.SaveModuleControl(kvp.Value, clearCache);
                }
            }
            if (clearCache)
            {
                DataCache.ClearHostCache(true);
            }
            return(moduleDefinitionID);
        }
Ejemplo n.º 9
0
        void LoadControlByKey(string controlKey)
        {
            var moduleToLoad = ModuleControlController.GetModuleControlByControlKey(controlKey,
                                                                                    ModuleContext.Configuration.
                                                                                    ModuleDefID);

            if (moduleToLoad != null)
            {
                var controlSrc = string.Format("~/{0}", moduleToLoad.ControlSrc);
                var view       = (PortalModuleBase)(LoadControl(controlSrc));
                view.ID = Path.GetFileNameWithoutExtension(controlSrc);
                view.ModuleContext.Configuration = ModuleContext.Configuration;
                PlaceHolderControl.Controls.Add(view);
            }
        }
Ejemplo n.º 10
0
        private static void EnsureEditScriptControlIsRegistered(int moduleDefId)
        {
            if (ModuleControlController.GetModuleControlByControlKey("EditRazorScript", moduleDefId) != null)
            {
                return;
            }
            var m = new ModuleControlInfo
            {
                ControlKey   = "EditRazorScript",
                ControlSrc   = "DesktopModules/RazorModules/RazorHost/EditScript.ascx",
                ControlTitle = "Edit Script",
                ControlType  = SecurityAccessLevel.Host,
                ModuleDefID  = moduleDefId
            };

            ModuleControlController.UpdateModuleControl(m);
        }
Ejemplo n.º 11
0
        private static string GetModuleEditContentUrl(ModuleInfo module)
        {
            var moduleControl = ModuleControlController.GetModuleControlByControlKey("Edit", module.ModuleDefID);

            if (moduleControl != null && moduleControl.ControlType == SecurityAccessLevel.Edit && !string.IsNullOrEmpty(moduleControl.ControlTitle))
            {
                var parameters = new List <string> {
                    "mid=" + module.ModuleID
                };
                if (moduleControl.SupportsPopUps)
                {
                    parameters.Add("popUp=true");
                }

                return(_navigationManager.NavigateURL(module.TabID, PortalSettings.Current, moduleControl.ControlKey, parameters.ToArray()));
            }

            return(string.Empty);
        }
Ejemplo n.º 12
0
        private void EnsureEditScriptControlIsRegistered()
        {
            var moduleDefId = this.ParentModule.ModuleConfiguration.ModuleDefID;

            if (ReferenceEquals(ModuleControlController.GetModuleControlByControlKey("EditRazorScript", moduleDefId),
                                null))
            {
                var m = default(ModuleControlInfo);
                m = new ModuleControlInfo
                {
                    ControlKey   = "EditRazorScript",
                    ControlSrc   = "DesktopModules/RazorModules/RazorHost/EditScript.ascx",
                    ControlTitle = "Edit Script",
                    ControlType  = SecurityAccessLevel.Host,
                    ModuleDefID  = moduleDefId
                };
                ModuleControlController.UpdateModuleControl(m);
            }
        }
Ejemplo n.º 13
0
        public static ModuleInfo GetSlaveModule(int tabId)
        {
            var key      = GetControlKey();
            var moduleId = GetModuleId(key);

            ModuleInfo slaveModule = GetSlaveModule(moduleId, key, tabId);

            if (slaveModule != null)
            {
                var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID) ??
                                    ModuleControlController.GetModuleControlByControlKey(key, Null.NullInteger);
                if (moduleControl != null)
                {
                    slaveModule.ModuleControlId = moduleControl.ModuleControlID;
                }
            }

            return(slaveModule);
        }
Ejemplo n.º 14
0
 public bool HasSettings(Page Page, ModuleInfo Module)
 {
     try
     {
         ModuleControlInfo moduleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);
         if (moduleControlInfo != null)
         {
             Control          _control        = ModuleControlPipeline.LoadSettingsControl(Page, Module, moduleControlInfo.ControlSrc);
             ISettingsControl settingsControl = _control as ISettingsControl;
             if (settingsControl != null)
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
     }
     return(false);
 }
Ejemplo n.º 15
0
        private bool ProcessSlaveModule()
        {
            var success     = true;
            var key         = UIUtilities.GetControlKey();
            var moduleId    = UIUtilities.GetModuleId(key);
            var slaveModule = UIUtilities.GetSlaveModule(moduleId, key, PortalSettings.ActiveTab.TabID);

            Pane pane;

            Panes.TryGetValue(Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            slaveModule.PaneName     = Globals.glbDefaultPane;
            slaveModule.ContainerSrc = PortalSettings.ActiveTab.ContainerSrc;
            if (String.IsNullOrEmpty(slaveModule.ContainerSrc))
            {
                slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
            }
            slaveModule.ContainerSrc  = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
            slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);

            var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);

            if (moduleControl != null)
            {
                slaveModule.ModuleControlId = moduleControl.ModuleControlID;
                slaveModule.IconFile        = moduleControl.IconFile;
                if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, Null.NullString, slaveModule))
                {
                    success = InjectModule(pane, slaveModule);
                }
                else
                {
                    Response.Redirect(Globals.AccessDeniedURL(Localization.GetString("ModuleAccess.Error")), true);
                }
            }

            return(success);
        }
Ejemplo n.º 16
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            try
            {
                chkAllTabs.CheckedChanged            += OnAllTabsCheckChanged;
                chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged;
                chkWebSlice.CheckedChanged           += OnWebSliceCheckChanged;
                cboCacheProvider.TextChanged         += OnCacheProviderIndexChanged;
                cmdDelete.Click += OnDeleteClick;
                cmdUpdate.Click += OnUpdateClick;

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                //get ModuleId
                if ((Request.QueryString["ModuleId"] != null))
                {
                    _moduleId = Int32.Parse(Request.QueryString["ModuleId"]);
                }
                if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger)
                {
                    //This tab does not have a valid ContentItem
                    ModuleController.Instance.CreateContentItem(Module);

                    ModuleController.Instance.UpdateModule(Module);
                }

                //Verify that the current user has access to edit this module
                if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "MANAGE", Module))
                {
                    if (!(IsSharedViewOnly() && TabPermissionController.CanAddContentToPage()))
                    {
                        Response.Redirect(Globals.AccessDeniedURL(), true);
                    }
                }
                if (Module != null)
                {
                    //get module
                    TabModuleId = Module.TabModuleID;

                    //get Settings Control
                    ModuleControlInfo moduleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);

                    if (moduleControlInfo != null)
                    {
                        _control = ModuleControlFactory.LoadSettingsControl(Page, Module, moduleControlInfo.ControlSrc);

                        var settingsControl = _control as ISettingsControl;
                        if (settingsControl != null)
                        {
                            hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings",
                                                                             settingsControl.LocalResourceFile);
                            if (String.IsNullOrEmpty(hlSpecificSettings.Text))
                            {
                                hlSpecificSettings.Text =
                                    String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile),
                                                  Module.DesktopModule.FriendlyName);
                            }
                            pnlSpecific.Controls.Add(_control);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Exceptions.ProcessModuleLoadException(this, err);
            }
        }
 public ModuleControlInfo GetModuleControlByControlKey(string controlKey, int moduleDefID)
 {
     return(ModuleControlController.GetModuleControlByControlKey(controlKey, moduleDefID));
 }
Ejemplo n.º 18
0
        private bool ProcessSlaveModule()
        {
            ModuleController objModules  = new ModuleController();
            ModuleInfo       objModule   = null;
            ModuleInfo       slaveModule = null;
            int    moduleId = -1;
            string key      = "";
            bool   bSuccess = true;

            if (Request.QueryString["mid"] != null)
            {
                Int32.TryParse(Request.QueryString["mid"], out moduleId);
            }
            if (Request.QueryString["ctl"] != null)
            {
                key = Request.QueryString["ctl"];
            }
            if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
            {
                Int32.TryParse(Request.QueryString["moduleid"], out moduleId);
            }
            if (moduleId != -1)
            {
                objModule = objModules.GetModule(moduleId, PortalSettings.ActiveTab.TabID, false);
                if (objModule != null)
                {
                    slaveModule = objModule.Clone();
                }
            }
            if (slaveModule == null)
            {
                slaveModule             = new ModuleInfo();
                slaveModule.ModuleID    = moduleId;
                slaveModule.ModuleDefID = -1;
                slaveModule.TabID       = PortalSettings.ActiveTab.TabID;
            }
            if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
            {
                slaveModule.ModuleDefID = -1;
            }
            if (Request.QueryString["dnnprintmode"] != "true")
            {
                slaveModule.ModuleTitle = "";
            }
            slaveModule.Header           = "";
            slaveModule.Footer           = "";
            slaveModule.StartDate        = DateTime.MinValue;
            slaveModule.EndDate          = DateTime.MaxValue;
            slaveModule.PaneName         = Common.Globals.glbDefaultPane;
            slaveModule.Visibility       = VisibilityState.None;
            slaveModule.Color            = "";
            slaveModule.Border           = "";
            slaveModule.DisplayTitle     = true;
            slaveModule.DisplayPrint     = false;
            slaveModule.DisplaySyndicate = false;
            slaveModule.ContainerSrc     = PortalSettings.ActiveTab.ContainerSrc;
            if (string.IsNullOrEmpty(slaveModule.ContainerSrc))
            {
                slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
            }
            slaveModule.ContainerSrc  = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
            slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);
            Pane pane   = null;
            bool bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            ModuleControlInfo objModuleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);

            if (objModuleControl != null)
            {
                slaveModule.ModuleControlId = objModuleControl.ModuleControlID;
                slaveModule.IconFile        = objModuleControl.IconFile;
                if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, Null.NullString, slaveModule))
                {
                    bSuccess = InjectModule(pane, slaveModule);
                }
                else
                {
                    Response.Redirect(Common.Globals.AccessDeniedURL(MODULEACCESS_ERROR), true);
                }
            }
            return(bSuccess);
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            chkAllTabs.CheckedChanged            += OnAllTabsCheckChanged;
            chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged;
            chkWebSlice.CheckedChanged           += OnWebSliceCheckChanged;
            cboCacheProvider.TextChanged         += OnCacheProviderIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdUpdate.Click         += OnUpdateClick;
            dgOnTabs.NeedDataSource += OnPagesGridNeedDataSource;

            jQuery.RequestDnnPluginsRegistration();

            //get ModuleId
            if ((Request.QueryString["ModuleId"] != null))
            {
                _moduleId = Int32.Parse(Request.QueryString["ModuleId"]);
            }
            if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger)
            {
                //This tab does not have a valid ContentItem
                ModuleController.Instance.CreateContentItem(Module);

                ModuleController.Instance.UpdateModule(Module);
            }

            //Verify that the current user has access to edit this module
            if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "MANAGE", Module))
            {
                if (!(IsSharedViewOnly() && TabPermissionController.CanAddContentToPage()))
                {
                    Response.Redirect(Globals.AccessDeniedURL(), true);
                }
            }
            if (Module != null)
            {
                //get module
                TabModuleId = Module.TabModuleID;

                //get Settings Control
                ModuleControlInfo moduleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);

                if (moduleControlInfo != null)
                {
                    _control = ControlUtilities.LoadControl <Control>(Page, moduleControlInfo.ControlSrc);

                    var settingsControl = _control as ISettingsControl;
                    if (settingsControl != null)
                    {
                        //Set ID
                        var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(moduleControlInfo.ControlSrc);
                        if (fileNameWithoutExtension != null)
                        {
                            _control.ID = fileNameWithoutExtension.Replace('.', '-');
                        }

                        //add module settings
                        settingsControl.ModuleContext.Configuration = Module;

                        hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings", settingsControl.LocalResourceFile);
                        if (String.IsNullOrEmpty(hlSpecificSettings.Text))
                        {
                            hlSpecificSettings.Text = String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile), Module.DesktopModule.FriendlyName);
                        }
                        pnlSpecific.Controls.Add(_control);
                    }
                }
            }
        }
Ejemplo n.º 20
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            AdminActionsJSON  = "[]";
            CustomActionsJSON = "[]";
            Panes             = "[]";
            try
            {
                SupportsQuickSettings = false;
                DisplayQuickSettings  = false;
                ModuleTitle           = ModuleContext.Configuration.ModuleTitle;
                var moduleDefinitionId   = ModuleContext.Configuration.ModuleDefID;
                var quickSettingsControl = ModuleControlController.GetModuleControlByControlKey("QuickSettings", moduleDefinitionId);

                if (quickSettingsControl != null)
                {
                    SupportsQuickSettings = true;
                    var control = ModuleControlFactory.LoadModuleControl(Page, ModuleContext.Configuration, "QuickSettings", quickSettingsControl.ControlSrc);
                    control.ID += ModuleContext.ModuleId;
                    quickSettings.Controls.Add(control);

                    DisplayQuickSettings = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault("QS_FirstLoad", true);
                    ModuleController.Instance.UpdateModuleSetting(ModuleContext.ModuleId, "QS_FirstLoad", "False");

                    ClientResourceManager.RegisterScript(Page, "~/admin/menus/ModuleActions/dnnQuickSettings.js");
                }

                if (ActionRoot.Visible)
                {
                    //Add Menu Items
                    foreach (ModuleAction rootAction in ActionRoot.Actions)
                    {
                        //Process Children
                        var actions = new List <ModuleAction>();
                        foreach (ModuleAction action in rootAction.Actions)
                        {
                            if (action.Visible)
                            {
                                if ((EditMode && Globals.IsAdminControl() == false) ||
                                    (action.Secure != SecurityAccessLevel.Anonymous && action.Secure != SecurityAccessLevel.View))
                                {
                                    if (!action.Icon.Contains("://") &&
                                        !action.Icon.StartsWith("/") &&
                                        !action.Icon.StartsWith("~/"))
                                    {
                                        action.Icon = "~/images/" + action.Icon;
                                    }
                                    if (action.Icon.StartsWith("~/"))
                                    {
                                        action.Icon = Globals.ResolveUrl(action.Icon);
                                    }

                                    actions.Add(action);

                                    if (String.IsNullOrEmpty(action.Url))
                                    {
                                        validIDs.Add(action.ID);
                                    }
                                }
                            }
                        }

                        var oSerializer = new JavaScriptSerializer();
                        if (rootAction.Title == Localization.GetString("ModuleGenericActions.Action", Localization.GlobalResourceFile))
                        {
                            AdminActionsJSON = oSerializer.Serialize(actions);
                        }
                        else
                        {
                            if (rootAction.Title == Localization.GetString("ModuleSpecificActions.Action", Localization.GlobalResourceFile))
                            {
                                CustomActionsJSON = oSerializer.Serialize(actions);
                            }
                            else
                            {
                                SupportsMove = (actions.Count > 0);
                                Panes        = oSerializer.Serialize(PortalSettings.ActiveTab.Panes);
                            }
                        }
                    }
                    IsShared = ModuleContext.Configuration.AllTabs ||
                               PortalGroupController.Instance.IsModuleShared(ModuleContext.ModuleId, PortalController.Instance.GetPortal(PortalSettings.PortalId)) ||
                               TabController.Instance.GetTabsByModuleID(ModuleContext.ModuleId).Count > 1;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 21
0
            private static void DoIUpgradeable(PortalInfo pinfo)
            {
                UserInfo uInfo = UserController.Instance.GetCurrentUserInfo();

                IFolderInfo fi = FolderManager.Instance.GetFolder(pinfo.PortalID, "Images/");

                #region Copy Vthemes in portal folder

                string BaseEditorFolder = HttpContext.Current.Server.MapPath("~/Portals/_default/vThemes/" + ThemeManager.GetCurrentThemeName(pinfo.PortalID) + "/editor");
                Copy(BaseEditorFolder, BaseEditorFolder.Replace("_default", pinfo.PortalID.ToString()));
                try
                {
                    ThemeManager.ProcessScss(pinfo.PortalID);
                }
                catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); }

                string UXManagervDefaultPath = HttpContext.Current.Request.PhysicalApplicationPath + "DesktopModules\\Vanjaro\\Core\\Library\\Images";
                if (Directory.Exists(UXManagervDefaultPath) && fi != null)
                {
                    DirectoryInfo source = new DirectoryInfo(UXManagervDefaultPath);
                    foreach (System.IO.FileInfo _file in source.GetFiles())
                    {
                        if (!FileManager.Instance.FileExists(fi, _file.Name))
                        {
                            FileStream stream = new FileStream(_file.FullName, FileMode.Open, FileAccess.Read);
                            FileManager.Instance.AddFile(fi, _file.Name, stream);
                        }
                    }
                }
                #endregion

                bool IsVanjaroInstalled = PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("IsVanjaroInstalled");

                if (IsDistribution(pinfo.PortalID))
                {
                    HostController.Instance.Update("ControlPanel", "DesktopModules/Vanjaro/UXManager/Library/Base.ascx");

                    #region Add Signup
                    TabController controller = new TabController();
                    if (TabController.Instance.GetTabByName("Signup", pinfo.PortalID) == null)
                    {
                        TabInfo NewSignupTab = new TabInfo {
                            PortalID = pinfo.PortalID, TabName = "Signup", IsVisible = false
                        };
                        TabController.Instance.AddTab(NewSignupTab);
                    }
                    #endregion

                    #region Removing Subscribers

                    RoleInfo rInfo = RoleController.Instance.GetRoleByName(pinfo.PortalID, "Subscribers");
                    if (rInfo != null)
                    {
                        RoleController.Instance.DeleteRole(rInfo);
                    }

                    #endregion

                    #region Applying Home and Signup layout

                    List <Layout>  pageLayouts    = GetLayouts(pinfo);
                    TabInfo        HomeTab        = TabController.Instance.GetTabByName("Home", pinfo.PortalID);
                    Layout         homelayout     = pageLayouts.Where(a => a.Name == "Home").FirstOrDefault();
                    PortalSettings portalSettings = new PortalSettings(pinfo);
                    if (HomeTab != null && homelayout != null && portalSettings != null)
                    {
                        ProcessBlocks(pinfo.PortalID, homelayout.Blocks);

                        if (portalSettings.ActiveTab == null)
                        {
                            portalSettings.ActiveTab = new TabInfo();
                        }

                        portalSettings.ActiveTab.TabID = HomeTab.TabID;
                        PortalController.UpdatePortalSetting(pinfo.PortalID, "Redirect_AfterLogin", HomeTab.TabID.ToString(), false, portalSettings.CultureCode, false);
                        Dictionary <string, object> LayoutData = new Dictionary <string, object>
                        {
                            ["IsPublished"]    = false,
                            ["Comment"]        = string.Empty,
                            ["gjs-assets"]     = string.Empty,
                            ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(homelayout.Style.ToString(), pinfo.PortalID),
                            ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(homelayout.Content.ToString(), pinfo.PortalID),
                            ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(homelayout.ContentJSON.ToString(), pinfo.PortalID),
                            ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(homelayout.StyleJSON.ToString(), pinfo.PortalID)
                        };
                        Core.Managers.PageManager.Update(portalSettings, LayoutData);

                        Pages Page = Managers.PageManager.GetPages(HomeTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();

                        if (Page != null && uInfo != null)
                        {
                            WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                            Page.Version = 1;
                            Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                            Page.IsPublished = true;
                            Page.PublishedBy = uInfo.UserID;
                            Page.PublishedOn = DateTime.UtcNow;
                            PageFactory.Update(Page, uInfo.UserID);
                        }
                        pinfo.HomeTabId = HomeTab != null && !HomeTab.IsDeleted ? HomeTab.TabID : Null.NullInteger;
                    }

                    TabInfo SignUpTab    = TabController.Instance.GetTabByName("Signup", pinfo.PortalID);
                    Layout  Signuplayout = pageLayouts.Where(a => a.Name == "Signup").FirstOrDefault();
                    if (SignUpTab != null && Signuplayout != null && portalSettings != null)
                    {
                        ProcessBlocks(pinfo.PortalID, homelayout.Blocks);

                        if (portalSettings.ActiveTab == null)
                        {
                            portalSettings.ActiveTab = new TabInfo();
                        }

                        portalSettings.ActiveTab.TabID = SignUpTab.TabID;
                        Dictionary <string, object> LayoutData = new Dictionary <string, object>
                        {
                            ["IsPublished"]    = false,
                            ["Comment"]        = string.Empty,
                            ["gjs-assets"]     = string.Empty,
                            ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(Signuplayout.Style.ToString(), pinfo.PortalID),
                            ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(Signuplayout.Content.ToString(), pinfo.PortalID),
                            ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Signuplayout.ContentJSON.ToString(), pinfo.PortalID),
                            ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(Signuplayout.StyleJSON.ToString(), pinfo.PortalID)
                        };
                        Core.Managers.PageManager.Update(portalSettings, LayoutData);

                        Pages Page = Managers.PageManager.GetPages(SignUpTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();


                        if (Page != null && uInfo != null)
                        {
                            WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                            Page.Version = 1;
                            Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                            Page.IsPublished = true;
                            Page.PublishedBy = uInfo.UserID;
                            Page.PublishedOn = DateTime.UtcNow;
                            PageFactory.Update(Page, uInfo.UserID);
                        }
                    }

                    TabInfo NotFoundTab        = TabController.Instance.GetTabByName("404 Error Page", pinfo.PortalID);
                    Layout  NotFoundPagelayout = pageLayouts.Where(a => a.Name == "NotFoundPage").FirstOrDefault();
                    if (NotFoundTab != null && NotFoundPagelayout != null && portalSettings != null)
                    {
                        ProcessBlocks(pinfo.PortalID, homelayout.Blocks);

                        if (portalSettings.ActiveTab == null)
                        {
                            portalSettings.ActiveTab = new TabInfo();
                        }

                        portalSettings.ActiveTab.TabID = NotFoundTab.TabID;
                        Dictionary <string, object> LayoutData = new Dictionary <string, object>
                        {
                            ["IsPublished"]    = false,
                            ["Comment"]        = string.Empty,
                            ["gjs-assets"]     = string.Empty,
                            ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.Style.ToString(), pinfo.PortalID),
                            ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.Content.ToString(), pinfo.PortalID),
                            ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.ContentJSON.ToString(), pinfo.PortalID),
                            ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.StyleJSON.ToString(), pinfo.PortalID)
                        };
                        Core.Managers.PageManager.Update(portalSettings, LayoutData);

                        Pages Page = Managers.PageManager.GetPages(NotFoundTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();


                        if (Page != null && uInfo != null)
                        {
                            WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                            Page.Version = 1;
                            Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                            Page.IsPublished = true;
                            Page.PublishedBy = uInfo.UserID;
                            Page.PublishedOn = DateTime.UtcNow;
                            PageFactory.Update(Page, uInfo.UserID);
                        }

                        pinfo.Custom404TabId = NotFoundTab.TabID;
                    }

                    TabInfo ProfileTab    = TabController.Instance.GetTabByName("Profile", pinfo.PortalID);
                    Layout  Profilelayout = pageLayouts.Where(a => a.Name == "Profile").FirstOrDefault();
                    if (ProfileTab != null && Profilelayout != null && portalSettings != null)
                    {
                        ProfileTab.ParentId = TabController.Instance.GetTabByName("User", pinfo.PortalID).TabID;
                        TabController.Instance.UpdateTab(ProfileTab);
                        ProcessBlocks(pinfo.PortalID, homelayout.Blocks);
                        pinfo.UserTabId = ProfileTab.TabID;
                        if (portalSettings.ActiveTab == null)
                        {
                            portalSettings.ActiveTab = new TabInfo();
                        }

                        portalSettings.ActiveTab.TabID = ProfileTab.TabID;
                        Dictionary <string, object> LayoutData = new Dictionary <string, object>
                        {
                            ["IsPublished"]    = false,
                            ["Comment"]        = string.Empty,
                            ["gjs-assets"]     = string.Empty,
                            ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(Profilelayout.Style.ToString(), pinfo.PortalID),
                            ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(Profilelayout.Content.ToString(), pinfo.PortalID),
                            ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Profilelayout.ContentJSON.ToString(), pinfo.PortalID),
                            ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(Profilelayout.StyleJSON.ToString(), pinfo.PortalID)
                        };
                        Core.Managers.PageManager.Update(portalSettings, LayoutData);

                        Pages Page = Managers.PageManager.GetPages(ProfileTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();


                        if (Page != null && uInfo != null)
                        {
                            WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                            Page.Version = 1;
                            Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                            Page.IsPublished = true;
                            Page.PublishedBy = uInfo.UserID;
                            Page.PublishedOn = DateTime.UtcNow;
                            PageFactory.Update(Page, uInfo.UserID);
                        }
                    }

                    TabInfo SearchResultTab    = TabController.Instance.GetTabByName("Search Results", pinfo.PortalID);
                    Layout  SearchResultlayout = pageLayouts.Where(a => a.Name == "SearchResults").FirstOrDefault();
                    if (SearchResultTab != null && SearchResultlayout != null && portalSettings != null)
                    {
                        ProcessBlocks(pinfo.PortalID, homelayout.Blocks);
                        if (portalSettings.ActiveTab == null)
                        {
                            portalSettings.ActiveTab = new TabInfo();
                        }

                        portalSettings.ActiveTab.TabID = SearchResultTab.TabID;
                        Dictionary <string, object> LayoutData = new Dictionary <string, object>
                        {
                            ["IsPublished"]    = false,
                            ["Comment"]        = string.Empty,
                            ["gjs-assets"]     = string.Empty,
                            ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.Style.ToString(), pinfo.PortalID),
                            ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.Content.ToString(), pinfo.PortalID),
                            ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.ContentJSON.ToString(), pinfo.PortalID),
                            ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.StyleJSON.ToString(), pinfo.PortalID)
                        };
                        Core.Managers.PageManager.Update(portalSettings, LayoutData);

                        Pages Page = Managers.PageManager.GetPages(SearchResultTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();


                        if (Page != null && uInfo != null)
                        {
                            WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                            Page.Version = 1;
                            Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                            Page.IsPublished = true;
                            Page.PublishedBy = uInfo.UserID;
                            Page.PublishedOn = DateTime.UtcNow;
                            PageFactory.Update(Page, uInfo.UserID);
                        }
                    }


                    #endregion

                    #region Update Default SignUp Tab and Search Results page

                    pinfo.RegisterTabId = SignUpTab != null && !SignUpTab.IsDeleted ? SignUpTab.TabID : Null.NullInteger;
                    pinfo.LogoFile      = fi.FolderPath + "vanjaro_logo.png";
                    pinfo.SearchTabId   = SearchResultTab != null && !SearchResultTab.IsDeleted ? SearchResultTab.TabID : Null.NullInteger;

                    #endregion

                    #region Update SEO Settings
                    List <StringValue> SeoSettings = new List <StringValue>
                    {
                        new StringValue {
                            Text = FriendlyUrlSettings.ReplaceSpaceWithSetting, Value = "-"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.DeletedTabHandlingTypeSetting, Value = "Do404Error"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.ForceLowerCaseSetting, Value = "Y"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.RedirectUnfriendlySetting, Value = "Y"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.RedirectMixedCaseSetting, Value = "True"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.UsePortalDefaultLanguageSetting, Value = "True"
                        },
                        new StringValue {
                            Text = FriendlyUrlSettings.AutoAsciiConvertSetting, Value = "False"
                        },
                        new StringValue {
                            Text = "DefaultIconLocation", Value = "icons/Font Awesome"
                        },
                    };
                    UpdatePortalSettings(SeoSettings, pinfo.PortalID, uInfo.UserID);
                    #endregion
                }
                if (!IsVanjaroInstalled)
                {
                    #region Signin Tab
                    if (pinfo.LoginTabId == -1)
                    {
                        if (TabController.Instance.GetTabByName("Signin", pinfo.PortalID) == null)
                        {
                            TabController tab = new TabController();

                            TabInfo NewSigninTab = new TabInfo {
                                PortalID = pinfo.PortalID, TabName = "Signin", IsVisible = false
                            };
                            int NewSigninTabID = TabController.Instance.AddTab(NewSigninTab);
                            NewSigninTab = tab.GetTab(NewSigninTabID, pinfo.PortalID);
                            if (NewSigninTab.TabPermissions.Where(t => t != null && t.RoleName == "All Users").FirstOrDefault() != null)
                            {
                                foreach (TabPermissionInfo p in NewSigninTab.TabPermissions.Where(t => t != null && t.RoleName == "All Users"))
                                {
                                    if (p.PermissionKey.ToLower() == "view")
                                    {
                                        p.AllowAccess = true;
                                    }
                                    else
                                    {
                                        p.AllowAccess = false;
                                    }
                                }
                            }
                            else
                            {
                                NewSigninTab.TabPermissions.Add(new TabPermissionInfo
                                {
                                    PermissionID = 3,
                                    TabID        = NewSigninTab.TabID,
                                    AllowAccess  = true,
                                    RoleID       = -1,
                                    RoleName     = "All Users",
                                });
                            }
                            TabPermissionController.SaveTabPermissions(NewSigninTab);
                            NewSigninTab.SkinSrc      = "[g]skins/vanjaro/base.ascx";
                            NewSigninTab.ContainerSrc = "[g]containers/vanjaro/base.ascx";
                            tab.UpdateTab(NewSigninTab);
                        }

                        List <Layout>  pageLayouts    = GetLayouts(pinfo);
                        TabInfo        SigninTab      = TabController.Instance.GetTabByName("Signin", pinfo.PortalID);
                        Layout         Signinlayout   = pageLayouts.Where(a => a.Name == "Signin").FirstOrDefault();
                        PortalSettings portalSettings = new PortalSettings(pinfo);
                        Layout         homelayout     = pageLayouts.Where(a => a.Name == "Home").FirstOrDefault();
                        if (SigninTab != null && Signinlayout != null && portalSettings != null)
                        {
                            ProcessBlocks(pinfo.PortalID, homelayout.Blocks);

                            if (portalSettings.ActiveTab == null)
                            {
                                portalSettings.ActiveTab = new TabInfo();
                            }

                            portalSettings.ActiveTab.TabID = SigninTab.TabID;
                            Dictionary <string, object> LayoutData = new Dictionary <string, object>
                            {
                                ["IsPublished"]    = false,
                                ["Comment"]        = string.Empty,
                                ["gjs-assets"]     = string.Empty,
                                ["gjs-css"]        = Managers.PageManager.DeTokenizeLinks(Signinlayout.Style.ToString(), pinfo.PortalID),
                                ["gjs-html"]       = Managers.PageManager.DeTokenizeLinks(Signinlayout.Content.ToString(), pinfo.PortalID),
                                ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Signinlayout.ContentJSON.ToString(), pinfo.PortalID),
                                ["gjs-styles"]     = Managers.PageManager.DeTokenizeLinks(Signinlayout.StyleJSON.ToString(), pinfo.PortalID)
                            };
                            Core.Managers.PageManager.Update(portalSettings, LayoutData);


                            Pages Page = Managers.PageManager.GetPages(SigninTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault();

                            if (Page != null && uInfo != null)
                            {
                                WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value);
                                Page.Version = 1;
                                Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2;

                                Page.IsPublished = true;
                                Page.PublishedBy = uInfo.UserID;
                                Page.PublishedOn = DateTime.UtcNow;
                                PageFactory.Update(Page, uInfo.UserID);
                            }
                        }
                        if (SigninTab != null)
                        {
                            Core.Managers.LoginManager.AddUpdateLoginModule(SigninTab.TabID, pinfo.PortalID);
                        }

                        pinfo.LoginTabId = SigninTab != null && !SigninTab.IsDeleted ? SigninTab.TabID : Null.NullInteger;
                    }
                    #endregion

                    #region Update Portal Settings
                    IFileInfo file;
                    if (fi != null)
                    {
                        if (FileManager.Instance.FileExists(fi, "vanjaro_social.png") && !PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("SocialSharingLogo"))
                        {
                            file = FileManager.Instance.GetFile(fi, "vanjaro_social.png");
                            PortalController.UpdatePortalSetting(pinfo.PortalID, "SocialSharingLogo", "FileID=" + file.FileId, true, pinfo.CultureCode);
                        }

                        if (FileManager.Instance.FileExists(fi, "vanjaro_home.png") && !PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("HomeScreenIcon"))
                        {
                            file = FileManager.Instance.GetFile(fi, "vanjaro_home.png");
                            PortalController.UpdatePortalSetting(pinfo.PortalID, "HomeScreenIcon", "FileID=" + file.FileId, true, pinfo.CultureCode);
                        }
                    }
                    PortalController.Instance.UpdatePortalInfo(pinfo);
                    List <StringValue> SettingNameValue = new List <StringValue>
                    {
                        new StringValue {
                            Text = "DNN_Enabled", Value = "False"
                        },
                        new StringValue {
                            Text = "Registration_UseEmailAsUserName", Value = "True"
                        },
                        new StringValue {
                            Text = "ClientResourcesManagementMode", Value = "p"
                        },
                        new StringValue {
                            Text = DotNetNuke.Web.Client.ClientResourceSettings.EnableCompositeFilesKey, Value = "True"
                        },
                        new StringValue {
                            Text = DotNetNuke.Web.Client.ClientResourceSettings.MinifyCssKey, Value = "True"
                        },
                        new StringValue {
                            Text = DotNetNuke.Web.Client.ClientResourceSettings.MinifyJsKey, Value = "True"
                        },
                        new StringValue {
                            Text = DotNetNuke.Web.Client.ClientResourceSettings.OverrideDefaultSettingsKey, Value = "True"
                        },
                    };
                    int CrmVersion = Host.CrmVersion + 1;
                    SettingNameValue.Add(new StringValue {
                        Text = DotNetNuke.Web.Client.ClientResourceSettings.VersionKey, Value = CrmVersion.ToString()
                    });
                    UpdatePortalSettings(SettingNameValue, pinfo.PortalID, uInfo.UserID);
                    #endregion
                }

                #region Delete Unnecessary Files
                string LayoutPath = HttpContext.Current.Server.MapPath("~/Portals/" + pinfo.PortalID + "/vThemes/" + Core.Managers.ThemeManager.GetCurrentThemeName(pinfo.PortalID) + "/templates");
                if (Directory.Exists(LayoutPath))
                {
                    Directory.Delete(LayoutPath, true);
                }
                #endregion

                #region Update ResetPassword module control
                ModuleControlInfo passwordResetModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("PasswordReset", Null.NullInteger);
                if (passwordResetModuleControlInfo != null)
                {
                    passwordResetModuleControlInfo.ControlSrc = "DesktopModules/Vanjaro/Core/Providers/Authentication/PasswordReset.ascx";
                }

                ModuleControlController.UpdateModuleControl(passwordResetModuleControlInfo);
                ModuleControlInfo registerModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("Register", Null.NullInteger);
                registerModuleControlInfo.ControlSrc = "DesktopModules/Vanjaro/Core/Providers/Authentication/Register.ascx";
                if (registerModuleControlInfo != null)
                {
                    ModuleControlController.UpdateModuleControl(registerModuleControlInfo);
                }
                #endregion


                if (IsDistribution(pinfo.PortalID))
                {
                    SoftDeleteModule(pinfo.PortalID, Components.Constants.SearchResult);
                }

                if (!IsVanjaroInstalled)
                {
                    PortalController.UpdatePortalSetting(pinfo.PortalID, "IsVanjaroInstalled", "-1");
                }

                if (fi != null)
                {
                    UpdateValue(pinfo.PortalID, 0, "security_settings", "Picture_DefaultFolder", fi.FolderID.ToString());
                }
            }