Inheritance: UnityEngine.ScriptableObject
        public void Initialize(ModuleSettings settings)
        {
            Res.RegisterResource<OauthExternalAuthenticationResources>();

            Config.RegisterSection<OAEConfig>();

            Bootstrapper.Initialized += Bootstrapper_Initialized;

            var oaeConfig = Config.Get<OAEConfig>();

            //Facebook
            if ((oaeConfig.FacebookAPPID != "YourAppId") && (oaeConfig.FacebookAPPSecretKey != "YourSecretKey"))
            {
                OpenAuth.AuthenticationClients.AddFacebook(
                    appId: oaeConfig.FacebookAPPID,
                 appSecret: oaeConfig.FacebookAPPSecretKey);
            }

            //Google
            if (oaeConfig.EnableGooglePlus && (OpenAuth.AuthenticationClients.GetByProviderName("google") != null))
                OpenAuth.AuthenticationClients.AddGoogle();

            //Amazon
            if (!String.IsNullOrEmpty(oaeConfig.AmazonAPPID) && !String.IsNullOrEmpty(oaeConfig.AmazonAPPSecretKey))
            {
                OpenAuth.AuthenticationClients.Add("Amazon", (Func<IAuthenticationClient>)(() =>
                    (IAuthenticationClient)new AmazonOpenAuthenticationProvider(oaeConfig.AmazonAPPID, oaeConfig.AmazonAPPSecretKey)), null);
            }
        }
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            var configManager = ConfigManager.GetManager();
            var modulesConfig = configManager.GetSection<SystemConfig>().ApplicationModules;
            var elasticSearchModule = modulesConfig.Elements.Where(el => el.GetKey().Equals(ModuleName)).FirstOrDefault();
            bool isAuditTrailModuleRegistered = modulesConfig.Elements.Any(el => el.GetKey().Equals(AuditModule.ModuleName));
            if (!isAuditTrailModuleRegistered && elasticSearchModule != null)
            {
                modulesConfig.Remove(elasticSearchModule);
                configManager.SaveChanges();
                return;
            }
            else if (!isAuditTrailModuleRegistered && elasticSearchModule == null)
            {
                return;
            }

            App.WorkWith()
               .Module(settings.Name)
               .Initialize()
               .Configuration<ElasticsearchAuditConfig>();

            var container = ObjectFactory.Container;
            container.RegisterType<IAuditLogger, ElasticsearchAuditLogger>("ElasticsearchAuditLogger");
        }
        /// <summary>
        /// Initializes the service with specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            Bootstrapper.Initialized -= this.Bootstrapper_Initialized;
            Bootstrapper.Initialized += this.Bootstrapper_Initialized;
        }
		public static string GenerateTransitionMethod(ModuleSettings settings, bool everyPlatformHasUniqueName) {
			
			var platformName = settings.GetPlatformName();
			var className = settings.GetPlatformClassName();

			var file = Resources.Load("UI.Windows/Social/Templates/TemplateTransitionMethod") as TextAsset;
			if (file == null) {
				
				Debug.LogError("Social Template Loading Error: Could not load template 'TemplateTransitionMethod'");
				
				return string.Empty;

			}
			
			var result = string.Empty;
			var multiModules = string.Empty;
			if (everyPlatformHasUniqueName == true) multiModules = className;

			var part = file.text;

			var moduleName = string.Format("UnityEngine.UI.Windows.Plugins.Social.Modules.Impl.{0}.{0}Module", className);

			result +=
				part.Replace("{MODULE_NAME}", moduleName)
					.Replace("{CLASS_NAME}", className)
					.Replace("{MULTI_MODULES_CLASS_NAME}", multiModules)
					.Replace("{PLATFORM_NAME}", platformName);

			return result;

		}
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);
            Config.RegisterSection<TemplateImporterConfig>();
            Res.RegisterResource<TemplateImporterResources>();

            TypeResolutionService.RegisterAssembly(typeof(TemplateImporterModule).Assembly.GetName());
        }
        public void Initialize(ModuleSettings settings)
        {
            Res.RegisterResource<RecaptchaResources>();

            Config.RegisterSection<RecaptchaConfig>();

            Bootstrapper.Initialized += Bootstrapper_Initialized;
        }
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);
            Config.RegisterSection<JobsConfig>();
            Res.RegisterResource<JobsResources>();

            SystemManager.RegisterWebService(typeof(JobsBackendService), JobsModule.WebServiceUrl);
            TypeResolutionService.RegisterAssembly(typeof(JobsModule).Assembly.GetName());
        }
        /// <summary>
        /// Initializes the service with specified settings.
        /// This method is called every time the module is initializing (on application startup by default)
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            App.WorkWith()
                .Module(settings.Name)
                    .Initialize()
                    .Localization<SuperFormsResources>();
        }
 /// <inheritdoc />
 public override void Initialize(ModuleSettings settings)
 {
     base.Initialize(settings);
     ObjectFactory.Container.RegisterType<ILessCompiler, SitefinityLessCompiler>(new ContainerControlledLifetimeManager(),new InjectionConstructor());
     App.WorkWith()
         .Module(settings.Name)
             .Initialize()
             .Configuration<LessConfig>();
 }
Exemple #10
0
        /// <summary>
        /// Initializes the service with specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            // initialize configuration file
            Config.RegisterSection<ProjectsConfig>();

            // register web services
            ObjectFactory.RegisterWebService(typeof(ProjectsBackendService), "Sitefinity/Services/Content/Projects.svc");
        }
 /// <summary>
 /// Initializes the service with specified settings.
 /// </summary>
 /// <param name="settings">The settings.</param>
 public override void Initialize(ModuleSettings settings)
 {
     base.Initialize(settings);
     App.WorkWith()
         .Module(BlogsImport.ModuleName)
         .Initialize()
             .Configuration<BlogsImportConfig>()
             .Localization<BlogsImportResources>()
             .BasicSettings<BlogsImportBasicSettingsView>("BlogsImport", "BasicSettingsTitle", "BlogsImportResources");
 }
		/// <summary>
		/// Initializes the service with specified settings.
		/// </summary>
		/// <param name="settings">The settings.</param>
		public override void Initialize(ModuleSettings settings)
		{
			base.Initialize(settings);

            // initialize configuration file
            App.WorkWith()
                .Module(settings.Name)
                .Initialize()
                    .Configuration<LocationsModuleConfig>()
                    .WebService<LocationsBackendService>("Sitefinity/Services/Content/Locations.svc");
		}
        /// <summary>
        /// Initializes the service with specified settings.
        /// This method is called every time the module is initializing (on application startup by default)
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            Config.RegisterSection<TwoFactorAuthenticationConfig>();

            App.WorkWith()
                .Module(settings.Name)
                    .Initialize()
                    .Localization<TwoFactorAuthenticationResources>();
        }
    public void EnableColorblindMode(bool enable)
    {
        if (!_colorblindCalled)
        {
            _colorblindCalled                  = true;
            FakeStatusLight.PassColor          = _modSettings.Settings.SolvedState;
            FakeStatusLight.FailColor          = _modSettings.Settings.StrikeState;
            FakeStatusLight.OffColor           = _modSettings.Settings.OffState;
            FakeStatusLight.MorseTransmitColor = _modSettings.Settings.MorseXmitState;
        }


        if (_colorblindEnabled || !enable)
        {
            return;
        }
        _colorblindEnabled = true;

        var defaultColors = new ModuleSettings();

        if (FakeStatusLight.PassColor == defaultColors.SolvedState &&
            FakeStatusLight.FailColor == defaultColors.StrikeState &&
            FakeStatusLight.OffColor == defaultColors.OffState &&
            FakeStatusLight.MorseTransmitColor == defaultColors.MorseXmitState)
        {
            FakeStatusLight.OffColor           = Random.value < 0.5f ? StatusLightState.Red : StatusLightState.Green;
            FakeStatusLight.MorseTransmitColor = StatusLightState.Off;
        }
        else
        {
            FakeStatusLight.PlayWord(null).MoveNext();
            if ((FakeStatusLight.OffColor == StatusLightState.Green &&
                 FakeStatusLight.MorseTransmitColor == StatusLightState.Red) ||
                (FakeStatusLight.OffColor == StatusLightState.Red &&
                 FakeStatusLight.MorseTransmitColor == StatusLightState.Green))
            {
                if (Random.value < 0.5f)
                {
                    FakeStatusLight.MorseTransmitColor = StatusLightState.Off;
                }
                else
                {
                    FakeStatusLight.OffColor = StatusLightState.Off;
                }
            }
        }
    }
Exemple #15
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            this.DeleteButton.Visible = true;
            this.UpdateButton.Visible = false;

            try
            {
                _moduleID = int.Parse(Request.Params["mID"]);

                module = RecyclerDB.GetModuleSettingsForIndividualModule(_moduleID);
                if (RecyclerDB.ModuleIsInRecycler(_moduleID))
                {
                    if (!Page.IsPostBack)
                    {
                        //load tab names for the dropdown list, then bind them
                        // TODO check if this works
                        //portalTabs = new PagesDB().GetPagesFlat(portalSettings.PortalID);
                        portalTabs = new PagesDB().GetPagesFlatTable(this.PortalSettings.PortalID);

                        ddTabs.DataBind();

                        //on initial load, disable the restore button until they make a selection
                        restoreButton.Enabled = false;
                        ddTabs.Items.Insert(0, "--Choose a Page to Restore this Module--");
                    }

                    // create an instance of the module
                    PortalModuleControl myPortalModule =
                        (PortalModuleControl)LoadControl(Path.ApplicationRoot + "/" + this.module.DesktopSrc);
                    myPortalModule.PortalID            = this.PortalSettings.PortalID;
                    myPortalModule.ModuleConfiguration = module;

                    // add the module to the placeholder
                    PrintPlaceHolder.Controls.Add(myPortalModule);
                }
                else
                //they're trying to view a module that isn't in the recycler - maybe a manual manipulation of the url...?
                {
                    pnlMain.Visible  = false;
                    pnlError.Visible = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemple #16
0
        /// <summary>
        /// Adds a new module to the navigation view. Called by the <see cref="ModuleNavigator"/>.
        /// </summary>
        /// <param name="moduleSettings">Module settings.</param>
        public void AddModule(ModuleSettings moduleSettings)
        {
            var navigationPanelItem = new NavigationPanelItem
            {
                NavigationPanelItemName = moduleSettings.ModuleName,
                ImageLocation           = moduleSettings.ModuleImagePath
            };

            foreach (ModuleGroup moduleGroup in moduleSettings.ModuleGroups)
            {
                var navigationList = new NavigationList {
                    NavigationListName = moduleGroup.ModuleGroupName
                };

                foreach (ModuleGroupItem moduleGroupItem in moduleGroup.ModuleGroupItems)
                {
                    var navigationListItem = new NavigationListItem
                    {
                        ItemName      = moduleGroupItem.ModuleGroupItemName,
                        ImageLocation = moduleGroupItem.ModuleGroupItemImagePath
                    };

                    OnRegisterNavigation(navigationListItem);

                    navigationList.NavigationListItems.Add(navigationListItem);

                    var navigationSettings = new NavigationSettings
                    {
                        Title = moduleGroupItem.TargetViewTitle,
                        View  = moduleGroupItem.TargetView
                    };

                    string navigationKey = string.Format("{0}.{1}.{2}",
                                                         navigationPanelItem.NavigationPanelItemName,
                                                         navigationList.NavigationListName,
                                                         navigationListItem.ItemName);

                    navigationListItem.Tag = navigationKey;
                    NavigationSettingsList.Add(navigationKey, navigationSettings);
                }

                navigationPanelItem.NavigationList.Add(navigationList);
            }

            NavigationPanelItems.Add(navigationPanelItem);
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                try
                {
                    string templatePath = CssTools.GetTemplatePath(this, StoreSettings.PortalTemplates);
                    CssTools.AddCss(Page, templatePath, StoreSettings.StyleSheet);

                    // Read module settings and define cart properties
                    Core.Cart.MiniCartSettings cartSettings = new ModuleSettings(ModuleId, TabId).MiniCart;
                    cartControl.ShowThumbnail       = cartSettings.ShowThumbnail;
                    cartControl.ThumbnailWidth      = cartSettings.ThumbnailWidth;
                    cartControl.GIFBgColor          = cartSettings.GIFBgColor;
                    cartControl.EnableImageCaching  = cartSettings.EnableImageCaching;
                    cartControl.CacheImageDuration  = cartSettings.CacheImageDuration;
                    cartControl.ProductColumn       = cartSettings.ProductColumn.ToLower();
                    cartControl.LinkToDetail        = cartSettings.LinkToDetail;
                    cartControl.IncludeVAT          = cartSettings.IncludeVAT;
                    cartControl.TemplatePath        = templatePath;
                    cartControl.ModuleConfiguration = ModuleConfiguration;
                    cartControl.StoreSettings       = StoreSettings;
                    cartControl.EditComplete       += cartControl_EditComplete;

                    _itemsCount = CurrentCart.GetItems(PortalId, StoreSettings.SecureCookie).Count;
                    if (_itemsCount == 0)
                    {
                        phlViewCart.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.ProcessModuleLoadException(this, ex);
                }
            }
            else
            {
                if (UserInfo.IsSuperUser)
                {
                    string ErrorSettings        = Localization.GetString("ErrorSettings", LocalResourceFile);
                    string ErrorSettingsHeading = Localization.GetString("ErrorSettingsHeading", LocalResourceFile);
                    UI.Skins.Skin.AddModuleMessage(this, ErrorSettingsHeading, ErrorSettings, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
                }
                divControls.Visible = false;
            }
        }
            public string GetValue(ModuleSettings settings)
            {
                var result = string.Empty;

                switch (this.type)
                {
                case Type.Constant:
                    result = this.value;
                    break;

                case Type.GetPermissions:
                    result = settings.GetPermissions();
                    break;
                }

                return(result);
            }
        /// <summary>
        /// Gets the current profile control.
        /// </summary>
        /// <returns></returns>
        public static Control GetCurrentProfileControl()
        {
            //default
            string RegisterPage = "Register.ascx";

            // 19/08/2004 Jonathan Fong
            // www.gt.com.au
            RainbowPrincipal user = HttpContext.Current.User as RainbowPrincipal;

            PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            //Select the actual register page
            if (portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"] != null &&
                portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString() != "Register.ascx")
            {
                RegisterPage = portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString();
            }
            System.Web.UI.Page x = new System.Web.UI.Page();

            // Modified by gman3001 10/06/2004, to support proper loading of a register module specified by 'Register Module ID' setting in the Portal Settings admin page
            int    moduleID         = int.Parse(portalSettings.CustomSettings["SITESETTINGS_REGISTER_MODULEID"].ToString());
            string moduleDesktopSrc = string.Empty;

            if (moduleID > 0)
            {
                moduleDesktopSrc = ModuleSettings.GetModuleDesktopSrc(moduleID);
            }
            if (moduleDesktopSrc.Length == 0)
            {
                moduleDesktopSrc = RegisterPage;
            }
            Control myControl = x.LoadControl(moduleDesktopSrc);
            // End Modification by gman3001

            PortalModuleControl p = ((PortalModuleControl)myControl);

            //p.ModuleID = int.Parse(portalSettings.CustomSettings["SITESETTINGS_REGISTER_MODULEID"].ToString());
            p.ModuleID = moduleID;
            if (p.ModuleID == 0)
            {
                ((SettingItem)p.Settings["MODULESETTINGS_SHOW_TITLE"]).Value = "false";
            }
            return((Control)p);

            return(null);
        }
Exemple #20
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            //only Update if the entered data is Valid
            if (Page.IsValid == true)
            {
                // Update settings in the database
                ModuleSettings.UpdateModuleSetting(ModuleID, "WeatherZip", WeatherZip.Text);
                ModuleSettings.UpdateModuleSetting(ModuleID, "WeatherCityIndex", WeatherCityIndex.Text);
                ModuleSettings.UpdateModuleSetting(ModuleID, "WeatherSetting",
                                                   WeatherSetting.Items[WeatherSetting.SelectedIndex].Value);
                ModuleSettings.UpdateModuleSetting(ModuleID, "WeatherDesign",
                                                   WeatherDesign.Items[WeatherDesign.SelectedIndex].Value);
                RedirectBackToReferringPage();
            }
        }
Exemple #21
0
        private void LoadSettings()
        {
            //cacheDependencyKey = "Module-" + moduleId.ToString();

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            config         = new ListConfiguration(moduleSettings);

            edDescription.WebEditor.ToolBar = ToolBar.FullWithTemplates;

            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            ddProtocol.Visible          = ListConfiguration.UseProtocolDropdown;
            fileBrowser.TextBoxClientId = txtUrl.ClientID;


            AddClassToBody("listedit");
        }
Exemple #22
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Module m = new Module(moduleID);

            ModuleSettings.UpdateModuleSetting(m.ModuleGuid, m.ModuleId, "HtmlFragmentSourceSetting", this.ddInclude.SelectedValue);
            CurrentPage.UpdateLastModifiedTime();
            //CacheHelper.TouchCacheDependencyFile(cacheDependencyKey);
            CacheHelper.ClearModuleCache(m.ModuleId);

            if (hdnReturnUrl.Value.Length > 0)
            {
                WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
                return;
            }

            WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
        }
Exemple #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!Page.IsPostBack)
         {
             chkEnabled.Checked         = ModuleSettings.GetValueOrDefault("Enabled", false);
             txtInstrumentationKey.Text = ModuleSettings.GetValueOrDefault("InstrumentationKey", string.Empty);
         }
         txtInstrumentationKey.Enabled = chkEnabled.Checked;
         rqInstrumentationKey.Enabled  = txtInstrumentationKey.Enabled;
     }
     catch (Exception ex)
     {
         Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
Exemple #24
0
        private void LoadSettings()
        {
            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            //we want to get the module using this method because it will let the module be editable when placed on the page with a ModuleWrapper
            module = SuperFlexiHelpers.GetSuperFlexiModule(moduleId);
            if (module == null)
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }
            config = new ModuleConfiguration(module);

            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            AddClassToBody("flexi-export " + config.EditPageCssClass);
        }
Exemple #25
0
        private void LoadSettings()
        {
            cacheDependencyKey = "Module-" + moduleId.ToString();

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            useDescription = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "LinksShowDescriptionSetting", false);

            descriptionOnly = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "LinksShowOnlyDescriptionSetting", descriptionOnly);

            //divDescription.Visible = useDescription;

            edDescription.WebEditor.ToolBar = ToolBar.FullWithTemplates;

            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();
        }
        protected virtual void LoadSettings()
        {
            config = new BlogPostListAdvancedConfiguration(Settings);

            blogConfig = new BlogConfiguration(ModuleSettings.GetModuleSettings(config.BlogModuleId));

            if (config.InstanceCssClass.Length > 0)
            {
                pnlOuterWrap.SetOrAppendCss(config.InstanceCssClass);
            }

            if (this.ModuleConfiguration != null)
            {
                this.Title       = ModuleConfiguration.ModuleTitle;
                this.Description = ModuleConfiguration.FeatureName;
            }
        }
Exemple #27
0
        public BlogPostListAdvancedConfiguration(Module module)
        {
            if (module != null)
            {
                this.module = module;
                siteId      = module.SiteId;
                featureGuid = module.FeatureGuid;
                settings    = ModuleSettings.GetModuleSettings(module.ModuleId);

                if (siteId < 1)
                {
                    siteId = CacheHelper.GetCurrentSiteSettings().SiteId;
                }

                LoadSettings(settings);
            }
        }
        private void LoadSettings()
        {
            appRoot = WebUtils.GetApplicationRoot();

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);


            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            CSetup.VerifyGalleryFolders(siteSettings.SiteId, moduleId);

            if (WebConfigSettings.ImageGalleryUseMediaFolder)
            {
                imageFolderPath = HttpContext.Current.Server.MapPath("~/Data/Sites/"
                                                                     + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/");

                thumbnailBaseUrl = ImageSiteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/";
            }
            else
            {
                imageFolderPath = HttpContext.Current.Server.MapPath("~/Data/Sites/"
                                                                     + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/");

                thumbnailBaseUrl = ImageSiteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/";
            }

            fullSizeImageFolderPath = imageFolderPath + "FullSizeImages" + Path.DirectorySeparatorChar;



            webImageHeightSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GalleryWebImageHeightSetting", -1);

            webImageWidthSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GalleryWebImageWidthSetting", -1);

            thumbNailHeightSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GalleryThumbnailHeightSetting", -1);

            thumbNailWidthSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GalleryThumbnailWidthSetting", -1);


            edDescription.WebEditor.ToolBar = ToolBar.Full;
        }
        public ModuleSimulationService(ModuleSettings settings, SimulationSettingsModule simulationSettings, IDTDLMessageService dtdlMessagingService, IDTDLCommandService dtdlCommandService, ILoggerFactory loggerFactory)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (simulationSettings == null)
            {
                throw new ArgumentNullException(nameof(simulationSettings));
            }

            if (dtdlMessagingService == null)
            {
                throw new ArgumentNullException(nameof(dtdlMessagingService));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            string logPrefix = "system".BuildLogPrefix();

            ModuleSettings     = settings;
            SimulationSettings = simulationSettings;
            _logger            = loggerFactory.CreateLogger <ModuleSimulationService>();

            _dtdlMessagingService = dtdlMessagingService;
            _dtdlCommandService   = dtdlCommandService;

            _telemetryInterval = 10;
            _stopProcessing    = false;

            _moduleClient = ModuleClient.CreateFromConnectionString(ModuleSettings.ConnectionString, Microsoft.Azure.Devices.Client.TransportType.Mqtt);
            _logger.LogDebug($"{logPrefix}::{ModuleSettings.ArtifactId}::Logger created.");
            _logger.LogDebug($"{logPrefix}::{ModuleSettings.ArtifactId}::Module simulator created.");

            //Default DTDL Model
            _defaultModel = ModuleSettings?.SupportedModels?.SingleOrDefault(i => i.ModelId == ModuleSettings.DefaultModelId);
            if (_defaultModel == null)
            {
                throw new Exception("No supported model corresponds to the default model Id.");
            }
        }
        private void CreateDefaultFolderSetting(string pathToGallery)
        {
            if (this.ModuleConfiguration == null)
            {
                return;
            }

            ModuleSettings.CreateModuleSetting(
                this.ModuleConfiguration.ModuleGuid,
                this.ModuleConfiguration.ModuleId,
                "FolderGalleryRootFolder",
                pathToGallery,
                "TextBox",
                string.Empty,
                string.Empty,
                string.Empty,
                100);
        }
Exemple #31
0
        /// <summary>
        /// Initializes the service with specified settings.
        /// This method is called every time the module is initializing (on application startup by default)
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            // Add your initialization logic here

            App.WorkWith()
            .Module(settings.Name)
            .Initialize()
            .Localization <CustomErrorPagesResources>()
            .Configuration <CustomErrorPagesConfig>()
            .WebService <CustomErrorPageItemsService>(CustomErrorPagesModule.CustomErrorPageItemsWebServiceUrl);

            // Here is also the place to register to some Sitefinity specific events like Bootstrapper.Initialized or subscribe for an event in with the EventHub class
            // Please refer to the documentation for additional information http://www.sitefinity.com/documentation/documentationarticles/developers-guide/deep-dive/sitefinity-event-system/ieventservice-and-eventhub

            //HttpContext.Current.ApplicationInstance.Error += new EventHandler(CustomErrorModule.Application_Error);
        }
Exemple #32
0
        private void LoadSettings()
        {
            timeOffset     = SiteUtils.GetUserTimeOffset();
            pageId         = WebUtils.ParseInt32FromQueryString("pageid", -1);
            moduleId       = WebUtils.ParseInt32FromQueryString("mid", -1);
            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            if (moduleSettings.Contains("ResultBarColor"))
            {
                resultBarColor = moduleSettings["ResultBarColor"].ToString();
            }

            if (CurrentPage.ContainsModule(moduleId))
            {
                currentModule = new Cynthia.Business.Module(moduleId);
                currentPoll   = new Poll(moduleId);
            }
        }
Exemple #33
0
        private void LoadSettings()
        {
            timeOffset     = SiteUtils.GetUserTimeOffset();
            timeZone       = SiteUtils.GetUserTimeZone();
            pageId         = WebUtils.ParseInt32FromQueryString("pageid", pageId);
            moduleId       = WebUtils.ParseInt32FromQueryString("mid", moduleId);
            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            if (moduleSettings.Contains("ResultBarColor"))
            {
                resultBarColor = moduleSettings["ResultBarColor"].ToString();
            }

            currentModule = GetModule(moduleId, Poll.FeatureGuid);
            currentPoll   = new Poll(moduleId);

            AddClassToBody("pollchoose");
        }
 protected override void OnInit(EventArgs e)
 {
     try
     {
         _cartSettings = new ModuleSettings(ModuleId, TabId);
         if (!IsPostBack)
         {
             lstProductColumn.Items.Add(new ListItem(Localization.GetString("ModelNumber", LocalResourceFile), "modelnumber"));
             lstProductColumn.Items.Add(new ListItem(Localization.GetString("ModelName", LocalResourceFile), "modelname"));
             lstProductColumn.Items.Add(new ListItem(Localization.GetString("ProductTitle", LocalResourceFile), "producttitle"));
         }
     }
     catch (Exception ex)
     {
         Exceptions.ProcessModuleLoadException(this, ex);
     }
     base.OnInit(e);
 }
Exemple #35
0
        /// <summary>
        /// Initializes the service with specified settings.
        /// This method is called every time the module is initializing (on application startup by default)
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            // Add your initialization logic here
            // here we register the module resources
            // but if you have you should register your module configuration or web service here

            App.WorkWith()
            .Module(settings.Name)
            .Initialize()
            .Localization <AMPResources>()
            .Configuration <AMPConfig>()
            .ServiceStackPlugin(new AmpServiceStackPlugin());

            // Here is also the place to register to some Sitefinity specific events like Bootstrapper.Initialized or subscribe for an event in with the EventHub class
            // Please refer to the documentation for additional information http://www.sitefinity.com/documentation/documentationarticles/developers-guide/deep-dive/sitefinity-event-system/ieventservice-and-eventhub
        }
Exemple #36
0
        public ModuleConfiguration(Module module, bool reloadDefinitionFromDisk = false)
        {
            if (module != null)
            {
                //log.Debug($"module {module.ModuleId} has siteid={module.SiteId}");
                if (module.SiteId < 1)
                {
                    Module m2 = new Module(module.ModuleId);
                    if (m2 != null)
                    {
                        module = m2;
                    }
                }

                this.module = module;
                this.siteId = module.SiteId;
                featureGuid = module.FeatureGuid;
                settings    = ModuleSettings.GetModuleSettings(module.ModuleId);

                //if (siteId < 1)
                //{
                //	if (siteSettings == null)
                //	{
                //		siteSettings = CacheHelper.GetCurrentSiteSettings();
                //	}
                //	siteId = siteSettings.SiteId;
                //}

                fsProvider = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];
                if (fsProvider == null)
                {
                    log.Error("File System Provider Could Not Be Loaded.");
                    return;
                }
                fileSystem = fsProvider.GetFileSystem(siteId);
                if (fileSystem == null)
                {
                    log.Error("File System Could Not Be Loaded.");
                    return;
                }

                LoadSettings(settings, reloadDefinitionFromDisk);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings() {
            try {
                if (Page.IsPostBack == false) {
                    //Check for existing settings and use those on this page
                    //Settings["SettingName"]
                    ModuleSettings set = new ModuleSettings(PortalId, ModuleId);
                    txtSetting1.Text = set.WarningTimeoutInMinutes.ToString();
                    /* uncomment to load saved settings in the text boxes
                            if (Settings.Contains("Setting2"))
                                txtSetting2.Text = Settings["Setting2"].ToString();

                            */

                }
            } catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
			public string GetValue(ModuleSettings settings) {

				var result = string.Empty;

				switch (this.type) {

				case Type.Constant:
					result = this.value;
					break;

				case Type.GetPermissions:
					result = settings.GetPermissions();
					break;

				}

				return result;

			}
    //Update this line each time you make changes to the Settings version.

    public bool InitializeSettings()
    {
        bool RewriteFile = false;

        if (Settings.ResetToDefault)
        {
            DebugLogInternal("Factory Reset requested.");
            Settings    = new ModuleSettings();
            RewriteFile = true;
        }

        if (Settings.SettingsVersion != ModSettingsVersion)
        {
            DebugLogInternal("New settings added since previous version.  Previous = {0}, Current = {1}", Settings.SettingsVersion, ModSettingsVersion);
            Settings.SettingsVersion = ModSettingsVersion;
            RewriteFile = true;
        }

        //Set up things that are not allowed to be done in the constructor here, such as Application.persistantDataPath related items.
        //Although the code would run and work correctly if done in the constructor, the Unity editor will complain with an "error".
        if (string.IsNullOrEmpty(Settings.SoundFileDirectory))
        {
            Settings.SoundFileDirectory = Path.Combine(Application.persistentDataPath, "AlarmClockExtender");
            DebugLogInternal("SoundFileDiretory is Null or Empty. Resetting to {0}", Settings.SoundFileDirectory);
            RewriteFile = true;
        }

        //This is also a good place to enforce limits
        if (Settings.ChanceOfNormalBeep < 0)
        {
            DebugLogInternal("ChanceOfNormalBeep < 0%.");
            Settings.ChanceOfNormalBeep = 0;
            RewriteFile = true;
        }
        if (Settings.ChanceOfNormalBeep > 100)
        {
            DebugLogInternal("ChanceOfNormalBeep > 100%.");
            Settings.ChanceOfNormalBeep = 100;
            RewriteFile = true;
        }

        return(RewriteFile);
    }
Exemple #40
0
        protected void BindControls()
        {
            if (this.moduleDefId > -1)
            {
                ModuleDefinition moduleDef = new ModuleDefinition(moduleDefId);
                //if (moduleDef.SiteID != siteSettings.SiteID) return;
                lnkModuleDefinition.Text = ResourceHelper.GetResourceString(moduleDef.ResourceFile, moduleDef.FeatureName);

                heading.Text = string.Format(CultureInfo.InvariantCulture, Resource.FeatureSettingsFormat, lnkModuleDefinition.Text);


                lnkModuleDefinition.ToolTip     = lnkModuleDefinition.Text;
                lnkModuleDefinition.NavigateUrl = SiteRoot + "/Admin/ModuleDefinitions.aspx?defid=" + moduleDefId.ToString();

                ArrayList defSettings = ModuleSettings.GetDefaultSettings(this.moduleDefId);
                this.grdSettings.DataSource = defSettings;
                this.grdSettings.DataBind();
            }
        }
Exemple #41
0
        private void LoadSettings()
        {
            moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            itemId   = WebUtils.ParseInt32FromQueryString("ItemID", -1);

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            GmapApiKey     = SiteUtils.GetGmapApiKey();

            if (moduleSettings.Contains("GoogleMapInitialMapTypeSetting"))
            {
                string gmType = moduleSettings["GoogleMapInitialMapTypeSetting"].ToString();
                try
                {
                    mapType = (MapType)Enum.Parse(typeof(MapType), gmType);
                }
                catch (ArgumentException) { }
            }

            GoogleMapHeightSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GoogleMapHeightSetting", GoogleMapHeightSetting);

            GoogleMapWidthSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GoogleMapWidthSetting", GoogleMapWidthSetting);

            GoogleMapInitialZoomSetting = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "GoogleMapInitialZoomSetting", GoogleMapInitialZoomSetting);


            GoogleMapEnableMapTypeSetting = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GoogleMapEnableMapTypeSetting", false);

            GoogleMapEnableZoomSetting = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GoogleMapEnableZoomSetting", false);

            GoogleMapShowInfoWindowSetting = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GoogleMapShowInfoWindowSetting", false);

            GoogleMapEnableLocalSearchSetting = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GoogleMapEnableLocalSearchSetting", false);

            GoogleMapEnableDirectionsSetting = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GoogleMapEnableDirectionsSetting", false);
        }
Exemple #42
0
        public void ShowInsuranceC47(DataSet ds, int IMonth, int IYear)
        {
            //ReportDocument rptDoc = new ReportDocument();
            ReportDocument rptDoc = null;

            //rptDoc.Load(@"Reports\BHXH\InsuranceC47.rpt");
            rptDoc = new Reports.BHXH.InsuranceC47();
            rptDoc.Refresh();
            rptDoc.SetDatabaseLogon(WorkingContext.Setting.UserName, WorkingContext.Setting.Password, WorkingContext.Setting.Server, WorkingContext.Setting.Database);
            rptDoc.SetDataSource(ds);
            rptDoc.Subreports["Part2"].SetDataSource(ds);
            rptDoc.DataDefinition.ParameterFields["IMonth"].ApplyCurrentValues(GetReportPara((object)IMonth));
            rptDoc.DataDefinition.ParameterFields["IYear"].ApplyCurrentValues(GetReportPara(IYear));
            if (rptDoc != null)
            {
                SetDBLogonForReport(rptDoc);
            }
            crViewer.ReportSource = rptDoc;

            settings = ModuleConfig.GetSettings();
            string   reportPart = settings.ReportPath;
            string   Targetfile = reportPart + "\\" + "BHXH mẫu C47" + "_" + IMonth + "_" + IYear + ".rpt";
            FileInfo fil        = new FileInfo(Targetfile);

            if (fil.Exists)
            {
                if (
                    MessageBox.Show("Đã tồn tại báo cáo này, có ghi đè không?", "Thông báo", MessageBoxButtons.YesNo) ==
                    DialogResult.Yes)
                {
                    fil.Delete();
                }
                else
                {
                    return;
                }
            }
            //reportDocument.SaveAs(Targetfile, true);
            //Application.DoEvents();
            rptDoc.ExportToDisk(ExportFormatType.CrystalReport, Targetfile);

            this.Show();
        }
        public void Initialize(ModuleSettings settings)
        {
            Res.RegisterResource <OauthExternalAuthenticationResources>();

            Config.RegisterSection <OAEConfig>();

            Bootstrapper.Initialized += Bootstrapper_Initialized;

            var oaeConfig = Config.Get <OAEConfig>();

            //Facebook
            if (!String.IsNullOrEmpty(oaeConfig.FacebookAPPID) && !String.IsNullOrEmpty(oaeConfig.FacebookAPPSecretKey))
            {
                ProviderDetails faecbookClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName == "facebook");
                if (faecbookClient == null)
                {
                    OpenAuth.AuthenticationClients.Add("facebook", () => new FacebookClientUpdated(
                                                           appId: oaeConfig.FacebookAPPID,
                                                           appSecret: oaeConfig.FacebookAPPSecretKey));
                }
            }

            //Google
            if (!String.IsNullOrEmpty(oaeConfig.GoogleClientID) && !String.IsNullOrEmpty(oaeConfig.GoogleClientSecret))
            {
                ProviderDetails googleClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName.ToLower() == "google");
                if (googleClient == null)
                {
                    OpenAuth.AuthenticationClients.Add("Google", () => new GoogleOAuth2Client(oaeConfig.GoogleClientID, oaeConfig.GoogleClientSecret)); 
                }
            }
            //Amazon
            if (!String.IsNullOrEmpty(oaeConfig.AmazonAPPID) && !String.IsNullOrEmpty(oaeConfig.AmazonAPPSecretKey))
            {
                ProviderDetails amazonClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName == "Amazon");
                if (amazonClient == null)
                {
                    //OpenAuth.AuthenticationClients.Add("Amazon", (Func<IAuthenticationClient>)(() => (IAuthenticationClient)new AmazonOpenAuthenticationProvider("amzn1.application-oa2-client.19782be9a3c54a29ba54ad753e9e4630", "ffb32157e1b759ec2e8a165a08456022a69d83a55b2ad5b80bce3dcdb2fd0da0")), null);
                    OpenAuth.AuthenticationClients.Add("Amazon", (Func <IAuthenticationClient>)(() =>
                                                                                                (IAuthenticationClient) new AmazonOpenAuthenticationProvider(oaeConfig.AmazonAPPID, oaeConfig.AmazonAPPSecretKey)), null);
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings() {
            try {
                var modules = new ModuleController();
                ModuleSettings set = new ModuleSettings(PortalId, ModuleId);

                //the following are two sample Module Settings, using the text boxes that are commented out in the ASCX file.
                //module settings
                //modules.UpdateModuleSetting(ModuleId, SettingKeysEnum.WarningTimeoutInMinutes.ToString(), txtSetting1.Text);
                set.WarningTimeoutInMinutes = Convert.ToInt32(txtSetting1.Text);
                //modules.UpdateModuleSetting(ModuleId, "Setting2", txtSetting2.Text);

                //tab module settings
                //modules.UpdateTabModuleSetting(TabModuleId, "Setting1",  txtSetting1.Text);
                //modules.UpdateTabModuleSetting(TabModuleId, "Setting2",  txtSetting2.Text);
            } catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemple #45
0
        private bool IsAllowed(ModerationRequest modReq)
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            if (siteSettings == null)
            {
                //log.Info("SiteSettings was null");
                return(false);
            }
            currentPage = CacheHelper.GetPage(modReq.PageId);
            if (
                (currentPage.PageId != modReq.PageId) ||
                (currentPage.SiteId != siteSettings.SiteId)
                )
            {
                log.Info("request rejected - pageid did not match");
                return(false);
            }

            thread = new ForumThread(modReq.ThreadId, modReq.PostId);

            if (thread.ModuleId != modReq.ModuleId)
            {
                log.Info("thread module id did not match");
                return(false);
            }
            forum = new Forum(thread.ForumId);

            module = GetModule(currentPage, thread.ModuleId);
            if (module == null)
            {
                log.Info("module not found in page modules");
                return(false);
            }

            config = new ForumConfiguration(ModuleSettings.GetModuleSettings(module.ModuleId));
            if (thread.PostUserId > -1)
            {
                postUser = new SiteUser(siteSettings, thread.PostUserId);
            }

            return(UserCanModerate(currentPage, module, forum));
        }
        private void PopulateCustomSettings()
        {
            // these are the Settings attached to the Module Definition
            DefaultSettings = ModuleSettings.GetDefaultSettings(this.module.ModuleDefId);
            // these are the settings attached to the module instance
            ArrayList customSettingValues = ModuleSettings.GetCustomSettingValues(this.module.ModuleId);

            foreach (CustomModuleSetting s in DefaultSettings)
            {
                bool found = false;
                foreach (CustomModuleSetting v in customSettingValues)
                {
                    if (v.SettingName == s.SettingName)
                    {
                        found = true;
                        AddSettingControl(v);
                    }
                }

                if (!found)
                {
                    // if a new module setting has been added since the
                    // last version upgrade, the code might reach this
                    // it means a Module Definition Setting was found for which there is not
                    // a Module Setting on this instance of the module, so we need to add the setting

                    ModuleSettings.CreateModuleSetting(
                        module.ModuleGuid,
                        moduleId,
                        s.SettingName,
                        s.SettingValue,
                        s.SettingControlType,
                        s.SettingValidationRegex,
                        s.ControlSrc,
                        s.HelpKey,
                        s.SortOrder);

                    // add control with default settings
                    AddSettingControl(s);
                }
            }
        }
        /// <summary>
        /// Initializes the service with specified settings.
        /// This method is called every time the module is initializing (on application startup by default)
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            App.WorkWith()
                .Module(settings.Name)
                    .Initialize()
                    .Localization<ImageOptimizationResources>();

            Config.RegisterSection<ImageOptimizationConfig>();

            GlobalConfiguration.Configuration.Routes.MapHttpRoute(
                name: "ImageOptimization",
                routeTemplate: "ImageOptimization/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            this.RegisterEventHandlers();

            ObjectFactory.Container.RegisterType<IImageProcessor, FocalPointImageProcessor>(new ContainerControlledLifetimeManager());
        }
Exemple #48
0
        private static ModuleSettings GetSettings()
        {
            SiteMap objSitemap = new SiteMap();
            PlugInSettings.AutoPopulate(objSitemap);

            if (!isValidRoot(objSitemap.Path))
            {
                objSitemap.Path = EPiServer.Global.BaseDirectory.Replace("/", "\\");
            }

            ModuleSettings objSettings = new ModuleSettings();

            objSettings.Path = objSitemap.Path;
            objSettings.TimeFormat = objSitemap.TimeFormat;
            objSettings.PageIds = objSitemap.PageIds;
            objSettings.DemoPageId = objSitemap.DemoPageId;


            return objSettings;
        }
		public SocialHttp(ModuleSettings settings, string url, HTTPParams parameters, HTTPType httpType, System.Action<string, bool> onCompleted) {

			#if USE_WWW
			if (httpType == HTTPType.Post) {

				var form = new WWWForm();
				foreach (var param in parameters.items) {

					form.AddField(param.key, param.GetValue(settings));

				}

				this.www = new WWW(url, form);

			} else if (httpType == HTTPType.Get) {

				foreach (var param in parameters.items) {

					url = url.Replace("{" + param.key + "}", param.GetValue(settings));

				}
				
				this.www = new WWW(url);

			}

			SocialSystem.WaitFor(this.Wait(() => {

				if (string.IsNullOrEmpty(this.www.error) == false) {
					
					Debug.LogError(this.www.error);

					// error
					onCompleted(this.www.error, false);

				} else {

					// success
					onCompleted(this.www.text, true);

				}

			}));
			#else
			if (httpType == HTTPType.Post) {
				
				var form = new WWWForm();
				foreach (var param in parameters.items) {
					
					form.AddField(param.key, param.GetValue(settings));
					
				}
				
				this.www = new WWW(url, form);
				
			} else if (httpType == HTTPType.Get) {
				
				foreach (var param in parameters.items) {
					
					url = url.Replace("{" + param.key + "}", param.GetValue(settings));
					
				}

				ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });

				var uri = new Uri(url.Trim() + "/");	// I don't know about last `/` but it works only with it ;(

				WebRequest request = WebRequest.Create (uri);
				// If required by the server, set the credentials.
				request.Credentials = CredentialCache.DefaultCredentials;
				// Get the response.
				HttpWebResponse response = (HttpWebResponse)request.GetResponse ();

				// Get the stream containing content returned by the server.
				Stream dataStream = response.GetResponseStream ();
				// Open the stream using a StreamReader for easy access.
				StreamReader reader = new StreamReader (dataStream);
				// Read the content.
				string responseFromServer = reader.ReadToEnd ();

				// Cleanup the streams and the response.
				reader.Close ();
				dataStream.Close ();
				response.Close ();
				
				onCompleted(responseFromServer, response.StatusCode == HttpStatusCode.OK);

			}
			#endif
			
			Debug.Log(url);

		}
        protected override void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);

            moduleSettings = new ModuleSettings(this.ModuleId,  this.TabId);
        }
Exemple #51
0
        private void MyList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            _settings = new ModuleSettings(this.ModuleId, this.TabId);
            catalogTabId = int.Parse(_settings.CategoryMenu.CatalogPage);
            if (catalogTabId <= 0)
            {
                catalogTabId = storeInfo.StorePageID;
            }
            // Do we have the category info?
            CategoryInfo categoryInfo = (e.Item.DataItem as CategoryInfo);
            if (categoryInfo != null)
            {
                // Did we find the hyperlink?
                HyperLink linkCategory = (e.Item.FindControl("linkCategory") as HyperLink);
                if (linkCategory != null)
                {
                    // Build the nav URL for this item
                    StringDictionary replaceParams = new StringDictionary();
                    replaceParams["CategoryID"] = categoryInfo.CategoryID.ToString();
                    replaceParams["ProductID"] = Null.NullString;
                    replaceParams["PageIndex"] = Null.NullString;

                    linkCategory.NavigateUrl = _nav.GetNavigationUrl(replaceParams, catalogTabId);

                    if (selectedCategoryID == categoryInfo.CategoryID)
                    {
                        //Set styling...
                        linkCategory.CssClass = "Store-CategoryMenu-ItemSelected";
                    }

                    if (parentCategories.Count > 0)
                    {
                        if (categoryInfo.CategoryID == ((CategoryInfo)parentCategories[0]).CategoryID)
                        {
                            //this is a root cat that needs to be expanded...
                            //DisplayChildCategories((CategoryInfo[])parentCategories.ToArray(typeof(CategoryInfo)), e.Item, storeInfo.StorePageID, 1);
                            DisplayChildCategories((CategoryInfo)parentCategories[0], e.Item, catalogTabId, 1);
                        }
                    }
                }
            }
        }
Exemple #52
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            /*
            Response.Write("<br>Page_load2 ");
            if (Page.IsPostBack)
                Response.Write("<br>Postback2 ");
            */

            /*
            if (Page.IsPostBack)
            {
                labelLog.Text = labelLog.Text + "<br>Page load PostBack" + DateTime.Now.ToString();
                int cat1 = -1;
                int.TryParse(DropDownList1.SelectedValue, out cat1);
                int cat2 = -1;
                int.TryParse(DropDownList2.SelectedValue, out cat2);
                labelLog.Text = labelLog.Text + "<br>dd1: " + cat1.ToString() + " dd2: " + cat2.ToString() + DateTime.Now.ToString();
            }
            else
            {
                labelLog.Text = labelLog.Text + "<br>Page load - Not a PostBack" + DateTime.Now.ToString();
            } */
                //Response.Write("Page_PreRender");

                npTitle = Localization.GetString("NPTitle.Text", this.LocalResourceFile);
                fpTitle = Localization.GetString("FPTitle.Text", this.LocalResourceFile);
                ppTitle = Localization.GetString("PPTitle.Text", this.LocalResourceFile);
                cpTitle = Localization.GetString("CPTitle.Text", this.LocalResourceFile);

                try
                {
                    if (storeInfo == null)
                    {
                        StoreController storeController = new StoreController();
                        storeInfo = storeController.GetStoreInfo(PortalId);
                        if (storeInfo.PortalTemplates)
                        {
                            templatesPath = PortalSettings.HomeDirectoryMapPath + "Store\\";
                            CssTools.AddCss(this.Page, PortalSettings.HomeDirectory + "Store", PortalId);
                        }
                        else
                        {
                            templatesPath = MapPath(ModulePath) + "\\";
                            CssTools.AddCss(this.Page, this.TemplateSourceDirectory, PortalId);
                        }
                    }

                    moduleSettings = new ModuleSettings(this.ModuleId, this.TabId);

                    catalogNav = new CatalogNavigation(Request.QueryString);

                    if (catalogNav.CategoryID == Null.NullInteger)
                    {
                        if (bool.Parse(moduleSettings.General.UseDefaultCategory))
                        {
                            catalogNav.CategoryID = int.Parse(moduleSettings.General.DefaultCategoryID);
                        }
                    }

                    if (catalogNav.ProductID != Null.NullInteger)
                    {
                        ProductController productController = new ProductController();
                        productInfo = productController.GetProduct(catalogNav.ProductID);
                        catalogNav.CategoryID = productInfo.CategoryID;
                    }

                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        CategoryController categoryController = new CategoryController();
                        categoryInfo = categoryController.GetCategory(catalogNav.CategoryID);
                    }

                    this.Controls.Add(TemplateController.ParseTemplate(templatesPath, moduleSettings.General.Template, new ProcessTokenDelegate(processToken)));

                    // Canadean changed: added current categoryid on a hidden dropdown, to use on the cascade categories
                    /*
                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        ddHidden.Items.Add(new ListItem(catalogNav.CategoryID.ToString(), catalogNav.CategoryID.ToString()));
                    }
                    */

                }
                catch (Exception ex)
                {
                    string ErrorSettings = Localization.GetString("ErrorSettings", this.LocalResourceFile);
                    Response.Write("<br>" + ex.Message);
                    Response.Write("<br>" + ex.StackTrace);

                    //Exceptions.ProcessModuleLoadException(ErrorSettings, this, ex, true);
                }
                if (DotNetNuke.Framework.AJAX.IsInstalled())
                {
                    DotNetNuke.Framework.AJAX.RegisterScriptManager();
                }

            //}
        }
Exemple #53
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Load utility objects
                _nav = new CatalogNavigation(Request.QueryString);
                _nav.ProductID = Null.NullInteger;	//Product should not be displayed!
                if (_nav.CategoryID == 0)
                {
                    _nav.CategoryID = Null.NullInteger;
                }

                //Get category and parent category data
                CategoryController categoryController = new CategoryController();
                selectedCategoryID = _nav.CategoryID;
                if (selectedCategoryID != Null.NullInteger)
                {
                    CategoryInfo category = categoryController.GetCategory(selectedCategoryID);
                    parentCategories.Add(category);
                    if (category.CategoryID != category.ParentCategoryID)
                    {
                        while (category.ParentCategoryID != Null.NullInteger)
                        {
                            category = categoryController.GetCategory(category.ParentCategoryID);
                            parentCategories.Add(category);
                            foreach (CategoryInfo cat in parentCategories)
                            {
                                if (cat.CategoryID == category.CategoryID)
                                {
                                    //Cyclical categories found
                                    break;
                                }
                            }
                        }
                    }
                }
                if (parentCategories.Count > 0)
                {
                    parentCategories.Reverse();
                }

                if (storeInfo == null)
                {
                    StoreController storeController = new StoreController();
                    storeInfo = storeController.GetStoreInfo(PortalId);
                    if (storeInfo.PortalTemplates)
                    {
                        CssTools.AddCss(this.Page, PortalSettings.HomeDirectory + "Store", PortalId);
                    }
                    else
                    {
                        CssTools.AddCss(this.Page, this.TemplateSourceDirectory, PortalId);
                    }
                }

                _settings = new ModuleSettings(this.ModuleId, this.TabId);
                // Databind to list of categories
                CategoryController controller = new CategoryController();
                ArrayList categoryList = controller.GetCategories(this.PortalId, false, -2);
                MyList.RepeatColumns = int.Parse(_settings.CategoryMenu.ColumnCount);
                MyList.DataSource = categoryList;
                MyList.DataBind();

                //MyList.SelectedIndex = GetSelectedIndex();
            }
            catch(Exception ex)
            {
                if (ex.InnerException != null)
                {
                    Exceptions.ProcessModuleLoadException(this, ex.InnerException);
                }
                else
                {
                    string ErrorSettings = Localization.GetString("ErrorSettings", this.LocalResourceFile);
                    Exceptions.ProcessModuleLoadException(ErrorSettings, this, ex, true);
                }
            }
        }
        public void Initialize(ModuleSettings settings)
        {
            Res.RegisterResource<OauthExternalAuthenticationResources>();

            Config.RegisterSection<OAEConfig>();

            Bootstrapper.Initialized += Bootstrapper_Initialized;

            var oaeConfig = Config.Get<OAEConfig>();

            //Facebook
            if (!String.IsNullOrEmpty(oaeConfig.FacebookAPPID) && !String.IsNullOrEmpty(oaeConfig.FacebookAPPSecretKey))
            {
                ProviderDetails faecbookClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName == "facebook");
                if (faecbookClient == null)
                {
                    OpenAuth.AuthenticationClients.AddFacebook(
                        appId: oaeConfig.FacebookAPPID,
                     appSecret: oaeConfig.FacebookAPPSecretKey);
                }
            }

            //Google
            if (!String.IsNullOrEmpty(oaeConfig.GoogleClientID) && !String.IsNullOrEmpty(oaeConfig.GoogleClientSecret))
            {
                 ProviderDetails googleClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName.ToLower() == "google");
                 if (googleClient == null)
                 {
                     OpenAuth.AuthenticationClients.Add("Google", () => new GoogleOAuth2Client(oaeConfig.GoogleClientID, oaeConfig.GoogleClientSecret));
                 }
            }
            //Amazon
            if (!String.IsNullOrEmpty(oaeConfig.AmazonAPPID) && !String.IsNullOrEmpty(oaeConfig.AmazonAPPSecretKey))
            {
                ProviderDetails amazonClient = OpenAuth.AuthenticationClients.GetAll().FirstOrDefault(client => client.ProviderName == "Amazon");
                if (amazonClient == null)
                {
                    //OpenAuth.AuthenticationClients.Add("Amazon", (Func<IAuthenticationClient>)(() => (IAuthenticationClient)new AmazonOpenAuthenticationProvider("amzn1.application-oa2-client.19782be9a3c54a29ba54ad753e9e4630", "ffb32157e1b759ec2e8a165a08456022a69d83a55b2ad5b80bce3dcdb2fd0da0")), null);
                    OpenAuth.AuthenticationClients.Add("Amazon", (Func<IAuthenticationClient>)(() =>
                        (IAuthenticationClient)new AmazonOpenAuthenticationProvider(oaeConfig.AmazonAPPID, oaeConfig.AmazonAPPSecretKey)), null);
                }
            }
        }
Exemple #55
0
        /// <summary>
        /// Initializes the service with specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            Bootstrapper.Initialized -= this.Bootstrapper_Initialized;
            Bootstrapper.Initialized += this.Bootstrapper_Initialized;

            SystemManager.RegisterServiceStackPlugin(new ListsServiceStackPlugin());
            SystemManager.RegisterServiceStackPlugin(new FilesServiceStackPlugin());
            SystemManager.RegisterServiceStackPlugin(new ReviewsServiceStackPlugin());

            this.controllerAssemblies = new ControllerContainerInitializer().RetrieveAssemblies();

            this.ninjectDependencyResolver = new StandardKernel();
            this.ninjectDependencyResolver.Load(this.controllerAssemblies);
        }
 /// <summary>
 /// Initializes the service with specified settings.
 /// </summary>
 /// <param name="settings">The settings.</param>
 public override void Initialize(ModuleSettings settings)
 {
     base.Initialize(settings);
     Config.RegisterSection<FundingConfig>();
     Res.RegisterResource<FundingResources>();
 }
		public bool IsPlatformActive(ModuleSettings settings) {

			foreach (var item in this.activePlatforms) {

				if (item.settings == settings) return item.active;

			}

			return false;

		}