コード例 #1
0
        public static List <IUIData> GetData(PortalSettings portalSettings, UserInfo userInfo)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>();

            var     PageList           = Library.Managers.PageManager.GetParentPages(PortalSettings.Current).Select(a => new { a.TabID, a.TabName, a.DisableLink });
            dynamic Results            = Managers.SecurityManager.GetRegistrationSettings(portalSettings);
            dynamic basicLoginSettings = Managers.SecurityManager.GetBasicLoginSettings(portalSettings);

            if (basicLoginSettings != null)
            {
                Settings.Add("UpdateBasicLoginSettingsRequest", new UIData {
                    Name = "UpdateBasicLoginSettingsRequest", Options = basicLoginSettings.UpdateBasicLoginSettingsRequest
                });
                Settings.Add("DefaultAuthProvider", new UIData {
                    Name = "DefaultAuthProvider", Options = basicLoginSettings.AuthProviders, OptionsText = "Name", OptionsValue = "Value", Value = basicLoginSettings.Settings.DefaultAuthProvider
                });
                Settings.Add("RedirectAfterLogin", new UIData {
                    Name = "RedirectAfterLogin", Options = PageList, OptionsText = "TabName", OptionsValue = "TabID", Value = basicLoginSettings.Settings.RedirectAfterLoginTabId.ToString()
                });
                Settings.Add("RedirectAfterLogout", new UIData {
                    Name = "RedirectAfterLogout", Options = PageList, OptionsText = "TabName", OptionsValue = "TabID", Value = basicLoginSettings.Settings.RedirectAfterLogoutTabId.ToString()
                });
            }
            Settings.Add("UserRegistration", new UIData {
                Name = "UserRegistration", Options = Results
            });
            Settings.Add("RedirectAfterRegistration", new UIData {
                Name = "RedirectAfterRegistration", Options = PageList, OptionsText = "TabName", OptionsValue = "TabID", Value = Results.Settings.RedirectAfterRegistrationTabId.ToString()
            });
            Settings.Add("UpdateSslSettingsRequest", new UIData {
                Name = "UpdateSslSettingsRequest", Options = Managers.SecurityManager.GetSslSettings(portalSettings, userInfo)
            });

            List <TreeView> DefaultFolders = new List <TreeView>
            {
                new TreeView()
                {
                    Text = "Default", Value = -1
                }
            };

            DefaultFolders.AddRange(BrowseUploadFactory.GetFolders(portalSettings.PortalId));
            Settings.Add("Picture_DefaultFolder", new UIData {
                Name = "Picture_DefaultFolder", Options = DefaultFolders, Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Picture_DefaultFolder", AppFactory.GetViews())
            });
            Settings.Add("Video_DefaultFolder", new UIData {
                Name = "Video_DefaultFolder", Options = DefaultFolders, Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Video_DefaultFolder", AppFactory.GetViews())
            });
            Settings.Add("Picture_MaxUploadSize", new UIData {
                Name = "Picture_MaxUploadSize", Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Picture_MaxUploadSize", AppFactory.GetViews())
            });
            Settings.Add("Video_MaxUploadSize", new UIData {
                Name = "Video_MaxUploadSize", Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Video_MaxUploadSize", AppFactory.GetViews())
            });
            Settings.Add("Picture_AllowableFileExtensions", new UIData {
                Name = "Picture_AllowableFileExtensions", Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Picture_AllowableFileExtensions", AppFactory.GetViews())
            });
            Settings.Add("Video_AllowableFileExtensions", new UIData {
                Name = "Video_AllowableFileExtensions", Value = Core.Managers.SettingManager.GetValue(portalSettings.PortalId, 0, Identifier.security_settings.ToString(), "Video_AllowableFileExtensions", AppFactory.GetViews())
            });
            if (userInfo.IsSuperUser)
            {
                Settings.Add("AutoAccountUnlockDuration", new UIData {
                    Name = "AutoAccountUnlockDuration", Value = Host.AutoAccountUnlockDuration.ToString()
                });
                Settings.Add("AsyncTimeout", new UIData {
                    Name = "AsyncTimeout", Value = Host.AsyncTimeout.ToString()
                });
                Settings.Add("FileExtensions", new UIData {
                    Name = "FileExtensions", Value = Host.AllowedExtensionWhitelist.ToStorageString()
                });
                Settings.Add("MaxUploadSize", new UIData {
                    Name = "MaxUploadSize", Value = (Config.GetMaxUploadSize() / (1024 * 1024)).ToString()
                });
            }
            Settings.Add("IsSuperUser", new UIData {
                Name = "IsSuperUser", Value = userInfo.IsSuperUser.ToString()
            });
            return(Settings.Values.ToList());
        }
コード例 #2
0
        internal static List <IUIData> GetData(PortalSettings portalSettings, ModuleInfo moduleInfo, Dictionary <string, string> parameters)
        {
            int PortalID = portalSettings.PortalId;
            int ModuleID = 0;

            if (moduleInfo != null)
            {
                ModuleID = moduleInfo.ModuleID;
            }

            string profile = string.Empty;

            if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.ToString().Contains("profile="))
            {
                profile = HttpContext.Current.Request.UrlReferrer.ToString().Split('=').Last();
            }
            else if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.ToString().Contains("profile/"))
            {
                profile = HttpContext.Current.Request.UrlReferrer.ToString().Split('/').Last();
                if (profile.Contains('?'))
                {
                    profile = profile.Split('?').First();
                }
            }
            Dictionary <string, IUIData> Settings           = new Dictionary <string, IUIData>();
            List <HTMLEditor_Profile>    HTMLEditorProfiles = GetHTMLEditorProfiles(PortalID);
            int ProfileID = 0;

            Settings.Add("UID", new UIData()
            {
                Name = "UID", Value = parameters.Where(p => p.Key == "uid").FirstOrDefault().Value
            });
            HTMLEditor Editor = HTMLEditor.Query("where UID=@0", Settings["UID"].Value + ModuleID).SingleOrDefault();

            if (Editor != null)
            {
                ProfileID = Editor.ProfileID;
                HTMLEditorSetting HTMLEditorSetting = DotNetNuke.Common.Utilities.Json.Deserialize <HTMLEditorSetting>(Editor.Settings);
                if (HTMLEditorSetting.UploadFilesRootFolder == 0)
                {
                    HTMLEditorSetting.UploadFilesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID;
                }

                if (HTMLEditorSetting.UploadImagesRootFolder == 0)
                {
                    HTMLEditorSetting.UploadImagesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID;
                }

                Settings.Add("Settings", new UIData()
                {
                    Name = "Settings", Options = HTMLEditorSetting
                });
            }
            else
            {
                if (!string.IsNullOrEmpty(profile) && HTMLEditorProfiles.Where(p => p.Name.ToLower() == profile.ToLower()).FirstOrDefault() != null)
                {
                    ProfileID = HTMLEditorProfiles.Where(p => p.Name.ToLower() == profile.ToLower()).FirstOrDefault().ProfileID;
                }

                HTMLEditorSetting HTMLEditorSetting = new HTMLEditorSetting();
                HTMLEditorSetting.UploadFilesRootFolder = HTMLEditorSetting.UploadImagesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID;
                Settings.Add("Settings", new UIData()
                {
                    Name = "Settings", Options = HTMLEditorSetting
                });
            }

            Settings.Add("Profiles", new UIData()
            {
                Name = "Profiles", Options = HTMLEditorProfiles, Value = ProfileID.ToString()
            });
            Settings.Add("EditorOptions", new UIData()
            {
                Name = "EditorOptions", Options = GetEditorOptions(HTMLEditorProfiles, int.Parse(Settings["Profiles"].Value))
            });
            Settings.Add("LocalizationKeyValue", new UIData()
            {
                Name = "LocalizationKeyValue", Options = getLocalizationKeyValue()
            });
            Settings.Add("Folders", new UIData()
            {
                Name = "Folders", Options = BrowseUploadFactory.GetFolders(PortalID)
            });
            Settings.Add("IsSuperUser", new UIData()
            {
                Name = "IsSuperUser", Value = PortalSettings.Current.UserInfo.IsSuperUser.ToString()
            });
            Settings.Add("ModuleID", new UIData()
            {
                Name = "ModuleID", Value = ModuleID.ToString()
            });
            return(Settings.Values.ToList());
        }