public ActionResult Settings() { var settings = new Models.Settings(); var email = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault(FeatureController.SETTING_EMAIL, string.Empty); var zoneId = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault(FeatureController.SETTING_ZONEID, string.Empty); if (!string.IsNullOrEmpty(zoneId)) { zoneId = FIPSCompliant.DecryptAES(zoneId, Config.GetDecryptionkey(), PortalSettings.GUID.ToString()); } settings.Email = email; settings.ZoneID = zoneId; return(View(settings)); }
public static List <IUIData> GetSettings(int ModuleID) { CacheFactory.ClearCache(); Dictionary <string, IUIData> Settings = SettingFactory.GetDictionary(ModuleID, AppFactory.Identifiers.admin_notifications_email.ToString()); List <dynamic> ServerTypes = new List <dynamic> { new { AuthenticationType = "Anonymous" }, new { AuthenticationType = "NTLM" }, new { AuthenticationType = "Basic" } }; Settings["Authentication"].Options = ServerTypes; Settings["Authentication"].OptionsText = "AuthenticationType"; Settings["Authentication"].OptionsValue = "AuthenticationType"; Settings["Password"].Value = FIPSCompliant.DecryptAES(Settings["Password"].Value, Config.GetDecryptionkey(), Host.GUID, 1000); return(Settings.Values.ToList()); }
/// <summary>Handles the <see cref="IModuleViewBase.Initialize"/> event of the <see cref="Presenter{TView}.View"/>.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void View_Initialize(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.Username) || string.IsNullOrEmpty(this.Password) || string.IsNullOrEmpty(this.IAmKey) || string.IsNullOrEmpty(this.DiscussionKey)) { this.View.Model.AdminMessage = this.LocalizeString("ModuleNeedsToBeConfigured.Text"); return; } var decryptedPassword = FIPSCompliant.DecryptAES(this.Password, Config.GetDecryptionkey(), Host.GUID, 1200); var authenticationToken = HigherLogicService.GetAuthenticationToken(this.Username, decryptedPassword, this.IAmKey); var postTask = HigherLogicService.GetDiscussionPosts( this.DiscussionKey, this.MaxDiscussionsToRetrieve, this.MaxSubjectLength, this.MaxContentLength, this.IncludeStaff, this.IAmKey, authenticationToken); postTask.Wait(); var discussionPosts = postTask.Result.ToArray(); var tokenReplace = new TokenReplace(); this.View.Model.FooterTemplate = tokenReplace.ReplaceEnvironmentTokens( this.FooterTemplate, new Dictionary <string, string>(), "HL").AsRawHtml(); this.View.Model.HeaderTemplate = tokenReplace.ReplaceEnvironmentTokens( this.HeaderTemplate, new Dictionary <string, string>(), "HL").AsRawHtml(); if (!discussionPosts.Any()) { this.View.Model.NoRecordsTemplate = tokenReplace.ReplaceEnvironmentTokens( this.NoRecordsTemplate, new Dictionary <string, string>(), "HL").AsRawHtml(); return; } this.View.Model.HasRecords = true; var renderAttachemnts = this.ItemTemplate.Contains("[HL:Discussion:Attachments]"); this.View.Model.ItemTemplate = (from post in discussionPosts select tokenReplace.ReplaceEnvironmentTokens( this.ItemTemplate, this.BuildTokenDictionary(post, renderAttachemnts), "HL")) .Aggregate((template, itemTemplate) => $"{template}{itemTemplate}") .AsRawHtml(); } catch (AggregateException exc) { this.ProcessModuleLoadException(exc); this.View.Model.AdminMessage = exc.Message; } }
/// <summary>Handles the <see cref="IModuleViewBase.Initialize"/> event of the <see cref="Presenter{TView}.View"/> control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void View_Initialize(object sender, EventArgs e) { try { this.View.Model.HigherLogicUserName = HigherLogicFeedSettings.HigherLogicUsername.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.HigherLogicUsername.DefaultValue); var encryptedPassword = HigherLogicFeedSettings.HigherLogicPassword.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.HigherLogicPassword.DefaultValue); this.View.Model.HigherLogicPassword = FIPSCompliant.DecryptAES(encryptedPassword, Config.GetDecryptionkey(), Host.GUID, 1200); this.View.Model.HigherLogicIAMKey = HigherLogicFeedSettings.HigherLogicIAMKey.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.HigherLogicIAMKey.DefaultValue); this.View.Model.HigherLogicDiscussionKey = HigherLogicFeedSettings.HigherLogicDiscussionKey.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.HigherLogicDiscussionKey.DefaultValue); this.View.Model.MaxDiscussionsToRetrieve = HigherLogicFeedSettings.MaxDiscussionsToRetrieve.GetValueAsInt32For( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.MaxDiscussionsToRetrieve.DefaultValue); this.View.Model.MaxContentLength = HigherLogicFeedSettings.MaxContentLength.GetValueAsInt32For( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.MaxContentLength.DefaultValue); this.View.Model.MaxSubjectLength = HigherLogicFeedSettings.MaxSubjectLength.GetValueAsInt32For( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.MaxSubjectLength.DefaultValue); this.View.Model.IncludeStaff = HigherLogicFeedSettings.IncludeStaff.GetValueAsBooleanFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.IncludeStaff.DefaultValue); this.View.Model.DateFormat = HigherLogicFeedSettings.DateFormat.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.DateFormat.DefaultValue); if (string.IsNullOrEmpty(this.View.Model.HigherLogicUserName) || string.IsNullOrEmpty(this.View.Model.HigherLogicPassword) || string.IsNullOrEmpty(this.View.Model.HigherLogicIAMKey) || string.IsNullOrEmpty(this.View.Model.HigherLogicDiscussionKey)) { this.View.Model.HeaderTemplate = Localization.GetString("HeaderTemplate.Text", $"/DesktopModules/Engage/{Localization.LocalResourceDirectory}/{Localization.LocalSharedResourceFile}"); this.View.Model.ItemTemplate = Localization.GetString("ItemTemplate.Text", $"/DesktopModules/Engage/{Localization.LocalResourceDirectory}/{Localization.LocalSharedResourceFile}"); this.View.Model.FooterTemplate = Localization.GetString("FooterTemplate.Text", $"/DesktopModules/Engage/{Localization.LocalResourceDirectory}/{Localization.LocalSharedResourceFile}"); this.View.Model.NoRecordsTemplate = Localization.GetString("NoRecordsTemplate.Text", $"/DesktopModules/Engage/{Localization.LocalResourceDirectory}/{Localization.LocalSharedResourceFile}"); this.View.Model.AttachmentItemTemplate = Localization.GetString("AttachmentItemTemplate.Text", $"/DesktopModules/Engage/{Localization.LocalResourceDirectory}/{Localization.LocalSharedResourceFile}"); return; } this.View.Model.HeaderTemplate = HigherLogicFeedSettings.HeaderTemplate.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.HeaderTemplate.DefaultValue); this.View.Model.ItemTemplate = HigherLogicFeedSettings.ItemTemplate.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.ItemTemplate.DefaultValue); this.View.Model.FooterTemplate = HigherLogicFeedSettings.FooterTemplate.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.FooterTemplate.DefaultValue); this.View.Model.NoRecordsTemplate = HigherLogicFeedSettings.NoRecordsTemplate.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.NoRecordsTemplate.DefaultValue); this.View.Model.AttachmentItemTemplate = HigherLogicFeedSettings.AttachmentItemTemplate.GetValueAsStringFor( FeaturesController.SettingsPrefix, this.ModuleContext.Configuration, HigherLogicFeedSettings.AttachmentItemTemplate.DefaultValue); } catch (Exception exc) { this.ProcessModuleLoadException(exc); } }