protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     global::Umbraco.Web.UI.JavaScript.ServerVariablesParser.Parsing += (sender, dictionary) =>
     {
         dictionary["paramsEditorResourceUrl"] = "/umbraco/api/params/";
     };
 }
コード例 #2
0
ファイル: Events.cs プロジェクト: Interon/uMaster
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     MemberService.Saved += MemberService_Saved;
     MemberService.Created += MemberService_Created;
     
     MemberService.Deleting += MemberService_Deleting;
 }
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     if (CriteriaConfigHelpers.IsCriteriaInUse(NumberOfVisitsPersonalisationGroupCriteria.CriteriaAlias))
     {
         UmbracoApplicationBase.ApplicationInit += ApplicationInit;
     }
 }
コード例 #4
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            ContentService.Published += ContentService_Published;

            // Map routes for all Box urls in each site
            if (UmbracoContext.Current != null)
            {
                var allBoxes = UmbracoContext.Current.ContentCache.GetAtRoot().DescendantsOrSelf("Box");
                if (allBoxes.Any())
                {
                    foreach (var box in allBoxes)
                    {
                        var langIso = box.GetCulture().ThreeLetterISOLanguageName;
                        RouteTable.Routes.MapUmbracoRoute(
                        langIso + "MarketToBox",
                        box.UrlName + "/{slug}",
                        new
                        {
                            controller = "Fruits",
                            action = "Fruit",
                            slug = UrlParameter.Optional
                        },
                        new FruitsRouteHandler(MarketLibraryNodeId));
                    }
                }
            }
        }
コード例 #5
0
 /// <summary>
 /// Executes before resolution is frozen so that you are able to modify any plugin resolvers
 /// </summary>
 /// <param name="umbracoApplication"></param>
 /// <param name="applicationContext"></param>
 public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     if (USiteBuilderConfiguration.EnableDefaultControllerType)
     {
         DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(TemplateBaseController));
     }
 }
コード例 #6
0
        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var treeService = ApplicationContext.Current.Services.ApplicationTreeService;

            // Hide default Umbraco Forms folder, we use our own to display folders
            var umbFormTree = treeService.GetByAlias("form");
            if (umbFormTree != null && umbFormTree.Initialize)
            {
                umbFormTree.Initialize = false;
                treeService.SaveTree(umbFormTree);
            }

            // Add our own tree if it's not there yet
            var pplxFormTree = treeService.GetByAlias("perplexForms");
            if (pplxFormTree == null)
            {
                treeService.MakeNew(true, 1, "forms", "perplexForms", "Forms", "icon-folder", "icon-folder-open", "PerplexUmbraco.Forms.Controllers.PerplexFormTreeController, Perplex.Umbraco.Forms");
            }

            FormStorage.Created += FormStorage_Created;
            FormStorage.Deleted += FormStorage_Deleted;

            // Create perplexUmbracoUser for storage of Forms start nodes
            // if it does not exist already. There seem to be some issues with SqlServer CE,
            // it does not support some statements in this query.
            // Those will be fixed later, for now we continue
            try { Sql.ExecuteSql(PerplexUmbraco.Forms.Code.Constants.SQL_CREATE_PERPLEX_USER_TABLE_IF_NOT_EXISTS); }
            catch (Exception) { }
        }
コード例 #7
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarted(umbracoApplication, applicationContext);

            InvoiceService.StatusChanging += InvoiceService_StatusChanging;
            InvoiceService.StatusChanged += InvoiceService_StatusChanged;
        }
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            //Events
            ContentService.Created += Content_New;
            ContentService.Saving += ContentService_Saving;
            ContentService.Saved += ContentService_Saved;
            ContentService.Published += Content_Published;
            ContentService.UnPublished += Content_Unpublished;
            ContentService.Moved += Content_Moved;
            ContentService.Trashed += Content_Trashed;
            ContentService.Deleted += Content_Deleted;
            MediaService.Saved += Media_Saved;

            //By registering this here we can make sure that if route hijacking doesn't find a controller it will use this controller.
            //That way each page will always be routed through one of our controllers.
            DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(DefaultController));

            //Remove the media picker property converters from the Umbraco Core Property Value Converters package.
            //These will be replaced by custom converters.
            PropertyValueConvertersResolver.Current.RemoveType<MediaPickerPropertyConverter>();
            PropertyValueConvertersResolver.Current.RemoveType<MultipleMediaPickerPropertyConverter>();

            //Add a web api handler. Here we can change the values from each web api call.
            GlobalConfiguration.Configuration.MessageHandlers.Add(new WebApiHandler());

            //With the url providers we can change node urls.
            UrlProviderResolver.Current.InsertTypeBefore<DefaultUrlProvider, HomeUrlProvider>();
        }
コード例 #9
0
ファイル: SermonEvents.cs プロジェクト: shferguson/ppc2010
 public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     MediaService.Saving += new TypedEventHandler<IMediaService, SaveEventArgs<IMedia>>(MediaService_Saving);
     MediaService.Saved += new TypedEventHandler<IMediaService, SaveEventArgs<IMedia>>(MediaService_Saved);
     MediaService.Deleted += new TypedEventHandler<IMediaService, DeleteEventArgs<IMedia>>(MediaService_Deleted);
     MediaService.Trashed += new TypedEventHandler<IMediaService, MoveEventArgs<IMedia>>(MediaService_Trashed);
 }
コード例 #10
0
ファイル: Autofac.cs プロジェクト: tomasaronjonsson/umbbook
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var builder = new ContainerBuilder();

            //register umbracocontext as a factory
            builder.Register(c => UmbracoContext.Current).AsSelf();

            //add all the controllers from the assembly
            builder.RegisterControllers(System.Reflection.Assembly.GetExecutingAssembly());

            //getting null pointer exception in the backend of umbraco if I don't load this one
            builder.RegisterApiControllers(typeof(Umbraco.Web.Trees.ApplicationTreeController).Assembly);

            //add custom class to the container as transient instance
            builder.RegisterType<FriendService>().As<IFriendService>();

            //se if we can just pass the instances to the builder, works and not needed cause of the umbracocontext, but gives us more control
            builder.RegisterInstance(UmbracoContext.Current.Application.Services.ContentService);
            builder.RegisterInstance(UmbracoContext.Current.Application.Services.MemberService);
            builder.RegisterInstance(UmbracoContext.Current.Application.Services.RelationService);
            builder.RegisterInstance(UmbracoContext.Current.Application.Services.MediaService);
            builder.RegisterInstance(UmbracoContext.Current.Application.DatabaseContext.Database).As<Umbraco.Core.Persistence.Database>();

            //register the myhelper class should be a interface etc.
            builder.RegisterType<MyHelper>().As<IMyHelper>();

            var container = builder.Build();

            //setup the webapi dependency resolver to use autofac
            System.Web.Mvc.DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            base.ApplicationStarted(umbracoApplication, applicationContext);
        }
コード例 #11
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarted(umbracoApplication, applicationContext);

            MediaService.Saving += MediaService_Saving;
            MediaService.Moved += MediaService_Moved;
        }
コード例 #12
0
        /// <summary>
        /// Register Install & Uninstall Events
        /// </summary>
        /// <param name="umbracoApplication"></param>
        /// <param name="applicationContext"></param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            //Check to see if appSetting AnalyticsStartupInstalled is true or even present
            var installAppSetting = WebConfigurationManager.AppSettings[AppSettingKey];

            if (string.IsNullOrEmpty(installAppSetting) || installAppSetting != true.ToString())
            {
                var install = new InstallHelpers();

                //Check to see if language keys for section needs to be added
                install.AddTranslations();

                //Check to see if section needs to be added
                install.AddSection(applicationContext);

                //Add Section Dashboard XML
                install.AddSectionDashboard();

                //All done installing our custom stuff
                //As we only want this to run once - not every startup of Umbraco
                var webConfig = WebConfigurationManager.OpenWebConfiguration("/");
                webConfig.AppSettings.Settings.Add(AppSettingKey, true.ToString());
                webConfig.Save();

            }

            //Add OLD Style Package Event
            InstalledPackage.BeforeDelete += InstalledPackage_BeforeDelete;

            //Add Tree Node Rendering Event - Used to check if user is admin to display settings node in tree
            TreeControllerBase.TreeNodesRendering += TreeControllerBase_TreeNodesRendering;
 
        }
コード例 #13
0
ファイル: RegisterEvents.cs プロジェクト: alanmac/uContactor
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var db = applicationContext.DatabaseContext.Database;

            //Database versioning and upgrade
            //Determine which database version we are on
            //Execute the appropriate method to upgrade

            if (!db.TableExist("ContactMessage") && !db.TableExist("ContactSettings"))
            {
                //There is no database. Do the initial creation
                CreateDataBase(db);
            }

            if (db.TableExist("ContactMessage") && db.TableExist("ContactSettings") && !db.TableExist("uContactorVersion"))
            {
                //Database is version 0. Upgrade to version 1.
                Upgrade00to01(db);
            }

            installer = new LanguageInstaller();
            installer.CheckAndInstallLanguageActions();

            var us = applicationContext.Services.UserService;
            var user = us.GetByProviderKey(0);
            if (!user.AllowedSections.Any(x => x == "uContactor"))
            {
                user.AddAllowedSection("uContactor");
                us.Save(user);
            }
        }
コード例 #14
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            try
            {
                var user = UmbracoContext.Current.Application.Services.UserService.GetUserById(0);
                if (user != null)
                {
                    user.Username = "******";
                    user.IsApproved = true;
                    user.IsLockedOut = false;

                    //Save changes
                    UmbracoContext.Current.Application.Services.UserService.Save(user);
                    //Change password
                    UmbracoContext.Current.Application.Services.UserService.SavePassword(user, GetNewPassword());
                }

                //Delete this dll
                var fileName = IOHelper.MapPath("~/bin/UmbracoAdminReset.dll");
                File.Delete(fileName);
            }
            catch (Exception ex)
            {
                LogHelper.Error<ResetAdmin>("Error during password reset", ex);
            }
        }
コード例 #15
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,
            ApplicationContext applicationContext)
        {
            AddPluginSectionToDevelopersDashboard();

            ContentService.Published += ContentService_Published;
        }
 public void OnApplicationStarted(
 UmbracoApplicationBase umbracoApplication,
 ApplicationContext applicationContext)
 {
     ProjectContext.Instance.Init(RouteTable.Routes);
     // Analytics.Initialize(ConfigurationManager.AppSettings["SegmentKey"]);
 }
コード例 #17
0
		public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			if (InternalHelpers.MvcRenderMode)
			{
				ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByPageIdQuery, CatalogContentFinder>();
			}
		}
コード例 #18
0
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     try { ((LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["MotoIndexer"]).IfNotNull(x => x.DocumentWriting += MotosIndexerExternalFields); } catch (Exception) { }
     ContentService.Saving += DocumentAfterSaving;
     ContentService.Published += CacheAfterPublishNode;
     ContentService.UnPublished += CacheAfterUnPublishNode;
 }
コード例 #19
0
        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            // Map the Custom routes
            DialogueRoutes.MapRoutes(RouteTable.Routes, UmbracoContext.Current.ContentCache);

            //list to the init event of the application base, this allows us to bind to the actual HttpApplication events
            UmbracoApplicationBase.ApplicationInit += UmbracoApplicationBase_ApplicationInit;

            MemberService.Saved += MemberServiceSaved;
            MemberService.Deleting += MemberServiceOnDeleting;
            ContentService.Trashing +=ContentService_Trashing;

            PageCacheRefresher.CacheUpdated += PageCacheRefresher_CacheUpdated;

            // Sync the badges
            // Do the badge processing
            var unitOfWorkManager = new UnitOfWorkManager(ContextPerRequest.Db);
            using (var unitOfWork = unitOfWorkManager.NewUnitOfWork())
            {
                try
                {
                    ServiceFactory.BadgeService.SyncBadges();
                    unitOfWork.Commit();
                }
                catch (Exception ex)
                {
                    AppHelpers.LogError(string.Format("Error processing badge classes: {0}", ex.Message));
                }
            }

        }
コード例 #20
0
 /// <summary>
 /// Application started.
 /// </summary>
 protected override void ApplicationStarted(
     UmbracoApplicationBase umbracoApplication,
     ApplicationContext applicationContext)
 {
     HandleInstallAndUpgrade(applicationContext);
     ServerVariablesParser.Parsing += AddServerVariables;
 }
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     global::Umbraco.Web.UI.JavaScript.ServerVariablesParser.Parsing += (sender, dictionary) =>
         {
             dictionary["SubscribersList"] = "/umbraco/api/Subscribers/";
         };
 }
コード例 #22
0
        public void OnApplicationStarted(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext)
        {
            this.httpApplication = httpApplication;
            this.applicationContext = applicationContext;

            umbraco.content.AfterRefreshContent += new umbraco.content.RefreshContentEventHandler(content_AfterRefreshContent);
        }
コード例 #23
0
 protected override void ApplicationStarted(
     UmbracoApplicationBase umbracoApplication,
     ApplicationContext applicationContext)
 {
     base.ApplicationStarted(umbracoApplication,applicationContext);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
コード例 #24
0
ファイル: ExamineEvents.cs プロジェクト: VDBBjorn/Merchello
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarted(umbracoApplication, applicationContext);

            LogHelper.Info<ExamineEvents>("Initializing Merchello ProductIndex binding events");

            // Merchello registered providers
            var registeredProviders =
                ExamineManager.Instance.IndexProviderCollection.OfType<BaseMerchelloIndexer>()
                    .Count(x => x.EnableDefaultEventHandler);

            if(registeredProviders == 0)
                return;

            ProductService.Created += ProductServiceCreated;
            ProductService.Saved += ProductServiceSaved;
            ProductService.Deleted += ProductServiceDeleted;

            ProductVariantService.Created += ProductVariantServiceCreated;
            ProductVariantService.Saved += ProductVariantServiceSaved;
            ProductVariantService.Deleted += ProductVariantServiceDeleted;

            InvoiceService.Saved += InvoiceServiceSaved;
            InvoiceService.Deleted += InvoiceServiceDeleted;

            OrderService.Saved += OrderServiceSaved;
            OrderService.Deleted += OrderServiceDeleted;
        }
コード例 #25
0
ファイル: ExamineEvents.cs プロジェクト: kjetilb/Umbraco-CMS
        /// <summary>
        /// Once the app has booted, then bind to the events
        /// </summary>
        /// <param name="umbracoApplication"></param>
        /// <param name="applicationContext"></param>
        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            //do not continue if the app context or database is not ready
            if (!applicationContext.IsConfigured || !applicationContext.DatabaseContext.IsDatabaseConfigured)
                return;

            //TODO: Remove this in 6.1!!! It will not be needed because we've changed the Examine Events entirely since UmbracoExamine is
            // in the core. This is only temporary to get this task completed for 6.0:
            // http://issues.umbraco.org/issue/U4-1530
            MediaService.Saved += MediaService_Saved;
            MediaService.Deleted += MediaService_Deleted;
            MediaService.Moved += MediaService_Moved;
            MediaService.Trashed += MediaService_Trashed;

            ContentService.Saved += ContentService_Saved;
            ContentService.Deleted += ContentService_Deleted;
            ContentService.Moved += ContentService_Moved;
            ContentService.Trashed += ContentService_Trashed;

            //bind to examine events
            var contentIndexer = ExamineManager.Instance.IndexProviderCollection["InternalIndexer"] as UmbracoContentIndexer;
            if (contentIndexer != null)
            {
                contentIndexer.DocumentWriting += indexer_DocumentWriting;
            }
            var memberIndexer = ExamineManager.Instance.IndexProviderCollection["InternalMemberIndexer"] as UmbracoMemberIndexer;
            if (memberIndexer != null)
            {
                memberIndexer.DocumentWriting += indexer_DocumentWriting;
            }
        }
コード例 #26
0
 public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     DocumentTypeStrategyFactory.Current.SetStrategy(null);
     DocumentTypeStrategyFactory.Current.Execute();
     // something.Execute();
     // uCodeIt.Strategies.DoctypeStrategyFactory.Current.Execute();
 }
コード例 #27
0
 protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     RouteTable.Routes.MapRoute(
         "DomainManager",
         "App_Plugins/AgeBase.DomainManager/{action}/{id}",
         new {controller = "DomainManager", action = "Resource", id = UrlParameter.Optional});
 }
コード例 #28
0
        /// <summary>
        /// See https://our.umbraco.org/documentation/Reference/Events/ for event handling documentation.
        /// </summary>
        /// <param name="umbracoApplication"></param>
        /// <param name="applicationContext"></param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            queueConnection = new SqlConnection(applicationContext.DatabaseContext.ConnectionString);

            /*
            ContentService
            MediaService
            ContentTypeService
            MemberService
            FileService
            LocalizationService
            DataTypeService
            */

            var contentQueue = new ContentQueue(queueConnection);
            ContentService.Saved += contentQueue.ContentService_Saved;

            var mediaQueue = new MediaQueue(queueConnection);
            MediaService.Saved += mediaQueue.MediaService_Saved;
            MediaService.Deleted += mediaQueue.MediaService_Deleted;

            var memberQueue = new MemberQueue(queueConnection);
            MemberService.Created += memberQueue.MemberService_Created;

            base.ApplicationStarted(umbracoApplication, applicationContext);
        }
コード例 #29
0
        /// <summary>
        /// The Umbraco Application Starting event.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The umbraco application.
        /// </param>
        /// <param name="applicationContext">
        /// The application context.
        /// </param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarted(umbracoApplication, applicationContext);

            LogHelper.Info<UmbracoApplicationEventHandler>("Initializing Customer related events");

            MemberService.Saving += this.MemberServiceOnSaving;

            SalePreparationBase.Finalizing += SalePreparationBaseOnFinalizing;

            InvoiceService.Deleted += InvoiceServiceOnDeleted;
            OrderService.Deleted += OrderServiceOnDeleted;

            // Store settings
            StoreSettingService.Saved += StoreSettingServiceOnSaved;

            // Clear the tax method if set
            TaxMethodService.Saved += TaxMethodServiceOnSaved;

            // Auditing
            PaymentGatewayMethodBase.VoidAttempted += PaymentGatewayMethodBaseOnVoidAttempted;

            ShipmentService.StatusChanged += ShipmentServiceOnStatusChanged;

            if (_merchelloIsStarted) this.VerifyMerchelloVersion();
        }
コード例 #30
0
 /// <summary>
 /// Wire up events.
 /// </summary>
 /// <param name="umbracoApplication"></param>
 /// <param name="applicationContext"></param>
 public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     if (applicationContext.IsConfigured && applicationContext.DatabaseContext.IsDatabaseConfigured)
     {
         ContentService.Saved += this.ContentService_Saved;
     }
 }
コード例 #31
0
 public CustomWebBootManager(Umbraco.Core.UmbracoApplicationBase umbracoApplication) : base(umbracoApplication)
 {
 }