Example #1
0
 public LanguageController(ILanguageFacade languageFacade,
                           ICommandSender commandSender,
                           ILanguageRules languageRules,
                           IContextService contextService)
     : base(contextService)
 {
     _languageFacade = languageFacade;
     _commandSender  = commandSender;
     _languageRules  = languageRules;
 }
Example #2
0
 public ContextService(IHttpContextAccessor httpContextAccessor,
                       ISiteFacade siteFacade,
                       ILanguageFacade languageFacade,
                       IThemeFacade themeFacade)
 {
     _httpContextAccessor = httpContextAccessor;
     _siteFacade          = siteFacade;
     _languageFacade      = languageFacade;
     _themeFacade         = themeFacade;
 }
Example #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              ISiteInstallationService siteInstallationService,
                              IAppInstallationService appInstallationService,
                              IMembershipInstallationService membershipInstallationService,
                              ISiteRepository siteRepository,
                              ILanguageFacade languageFacade,
                              IPageFacade pageFacade)
        {
            appInstallationService.VerifyAppInstallation();
            siteInstallationService.VerifySiteInstallation();
            membershipInstallationService.VerifyUserCreation();

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            app.UseStatusCodePagesWithRedirects("~/error/{0}");

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/error/500");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            app.UseIdentity();

            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            var site            = siteRepository.GetByName("Default");
            var activeLanguages = languageFacade.GetAllActive(site.Id);
            var pages           = pageFacade.GetAllForAdminAsync(site.Id).Result;

            app.AddRoutes(site, activeLanguages, pages);
            app.AddLocalisation(activeLanguages);
        }
Example #4
0
        public void Setup()
        {
            _siteId     = Guid.NewGuid();
            _languageId = Guid.NewGuid();

            var language = LanguageFactory.Language(_siteId, _languageId, "", "", "");

            var repositoryMock = new Mock <ILanguageRepository>();

            repositoryMock.Setup(x => x.GetById(_siteId, _languageId)).Returns(language);
            repositoryMock.Setup(x => x.GetAll(_siteId)).Returns(new List <Language> {
                language
            });

            var cacheManagerMock = new Mock <ICacheManager>();

            _sut = new LanguageFacade(repositoryMock.Object, cacheManagerMock.Object, Shared.CreateNewMapper());
        }
Example #5
0
        public void Setup()
        {
            _siteId     = Guid.NewGuid();
            _languageId = Guid.NewGuid();

            var repositoryMock = new Mock <ILanguageRepository>();

            repositoryMock.Setup(x => x.GetById(_siteId, _languageId)).Returns(new Language());
            repositoryMock.Setup(x => x.GetAll(_siteId)).Returns(new List <Language>()
            {
                new Language(), new Language()
            });

            var cacheManagerMock = new Mock <ICacheManager>();

            var mapperMock = new Mock <AutoMapper.IMapper>();

            mapperMock.Setup(x => x.Map <LanguageAdminModel>(It.IsAny <Language>())).Returns(new LanguageAdminModel());

            _sut = new LanguageFacade(repositoryMock.Object, cacheManagerMock.Object, mapperMock.Object);
        }
Example #6
0
 public LanguageController(ILanguageFacade languageFacade,
                           IContextService contextService)
     : base(contextService)
 {
     _languageFacade = languageFacade;
 }
Example #7
0
 public TextModuleEventsHandler(ICacheManager cacheManager,
                                ILanguageFacade languageFacade)
 {
     _cacheManager   = cacheManager;
     _languageFacade = languageFacade;
 }
Example #8
0
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment hostingEnvironment,
                              ILoggerFactory loggerFactory,
                              ISiteInstallationService siteInstallationService,
                              IAppInstallationService appInstallationService,
                              IMembershipInstallationService membershipInstallationService,
                              ISiteRepository siteRepository,
                              ILanguageFacade languageFacade,
                              IPageFacade pageFacade)
        {
            membershipInstallationService.VerifyUserCreation();
            appInstallationService.VerifyAppInstallation();
            siteInstallationService.VerifySiteInstallation();

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            app.UseStatusCodePagesWithRedirects("~/error/{0}");

            if (hostingEnvironment.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/error/500");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            foreach (var appDescriptor in AppLoader.Instance(hostingEnvironment).AppDescriptors)
            {
                var contentPath = Path.Combine(hostingEnvironment.ContentRootPath, "Apps", appDescriptor.Folder, "wwwroot");
                if (Directory.Exists(contentPath))
                {
                    app.UseStaticFiles(new StaticFileOptions
                    {
                        RequestPath  = "/" + appDescriptor.Folder,
                        FileProvider = new PhysicalFileProvider(contentPath)
                    });
                }
            }

            foreach (var startup in AppLoader.Instance(hostingEnvironment).AppAssemblies.GetTypes <Mvc.Apps.IStartup>())
            {
                startup.Configure(app);
            }

            var applicationPartManager = app.ApplicationServices.GetRequiredService <ApplicationPartManager>();

            Parallel.ForEach(AppLoader.Instance(hostingEnvironment).AppAssemblies, assembly =>
            {
                applicationPartManager.ApplicationParts.Add(new AssemblyPart(assembly));
            });

            app.UseIdentity();

            var site            = siteRepository.GetByName("Default");
            var activeLanguages = languageFacade.GetAllActiveAsync(site.Id).Result;

            app.AddRoutes();
            app.AddLocalisation(activeLanguages);
        }
Example #9
0
 public MenuEventsHandler(ICacheManager cacheManager,
                          ILanguageFacade languageFacade)
 {
     _cacheManager   = cacheManager;
     _languageFacade = languageFacade;
 }
Example #10
0
 public LanguageSelectionViewComponent(ILanguageFacade languageFacade,
                                       IContextService contextService)
     : base(contextService)
 {
     _languageFacade = languageFacade;
 }