Exemplo n.º 1
0
 void Instance_PublishingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content as ParticipantBlock != null)
     {
         ParticipantBlock participant = (e.Content as ParticipantBlock);
         ParticipantLog.AddLogText("Saved", "Participant saved with e-mail " + participant.Email + " and status " + participant.AttendStatus, participant);
     }
 }
 private void BeforeMovingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content.Name.StartsWith("Fredrik"))
     {
         e.CancelAction = true;
         e.CancelReason = "You can not move Fredrik around!";
     }
 }
Exemplo n.º 3
0
 private void MovingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content.Name.StartsWith("Fredrik"))
     {
         e.CancelAction = true;
         e.CancelReason = "Man får inte flytta på Fredrik hur som helst...";
     }
 }
Exemplo n.º 4
0
 private void _contentEvents_PublishingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (string.Compare(e.Content.Name, "DoNotPublish", StringComparison.CurrentCultureIgnoreCase) == 0)
     {
         e.CancelAction = true;
         e.CancelReason = "Can't publish";
     }
 }
Exemplo n.º 5
0
        private void Service_SavingContent(object sender, EPiServer.ContentEventArgs e)
        {
            //Only call when an image is being uploaded
            if (e.ContentLink.WorkID == 0 && handler.Enabled && e.Content is ImageData && ((EPiServer.SaveContentEventArgs)e).Action == EPiServer.DataAccess.SaveAction.Publish)
            {
                var img = e.Content as ImageData;
                //Determine if Blob has changed / is new. If not, do nothing. Only act if relevant properties are empty/null

                handler.HandleImage(img);
            }
        }
Exemplo n.º 6
0
 void Service_MovedContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.TargetLink.CompareToIgnoreWorkID(SiteDefinition.Current.WasteBasket))
     {
         VulcanHandler.Service.DeleteContentEveryLanguage(e.ContentLink);
     }
     else
     {
         VulcanHandler.Service.IndexContentEveryLanguage(e.Content);
     }
 }
        private void SavingMediaFile(object sender, EPiServer.ContentEventArgs e)
        {
            if (!(e.Content is MediaData content))
            {
                return;
            }
            var fs = FileReader.GetFileSize(content);

            var mediaFile = content as IFileProperties;

            mediaFile.FileSize = fs;
        }
 /// <summary>
 /// Community Event for when a CommunityPage is published
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void SociaCommunityPage_PublishedEvent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content is CommunityPage)
     {
         var communityPage = e.Content as CommunityPage;
         var groupName     = communityPage.Name;
         var group         = groupRepository.Get(groupName);
         var url           = ExternalURL(communityPage);
         group.PageLink = url;
         group          = groupRepository.Update(group);
     }
 }
        /// <summary>
        /// Community Event for the creation of any CommunityPage
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SociaCommunityPage_CreationEvent(object sender, EPiServer.ContentEventArgs e)

        {
            if (e.Content is CommunityPage)
            {
                var communityPage = e.Content as CommunityPage;

                var       communityName = communityPage.Name;
                Community community;

                //Check if the community name exists in Social
                //If it does, the page will use the existing Social group and workflow details
                community = groupRepository.Get(communityName);
                if (community == null)
                {
                    //Build a new group
                    communityPage.MetaDescription = String.IsNullOrEmpty(communityPage.MetaDescription) ? "This is the home page for \"" + communityName + "\"" : communityPage.MetaDescription;
                    var groupDescription = communityPage.MetaDescription;
                    var socialGroup      = new Community(communityName, groupDescription);

                    //Add group to Social
                    socialGroup = groupRepository.Add(socialGroup);

                    //Add a workflow for the new group
                    this.moderationRepository.AddWorkflow(socialGroup);
                }

                //Configure CommentBlock
                communityPage.Comments.Heading      = communityName + " Comments";
                communityPage.Comments.ShowHeading  = true;
                communityPage.Comments.SendActivity = true;

                //Configure SubscriptionBlock
                communityPage.Subscriptions.ShowHeading = false;

                //Configure RatingsBlock
                communityPage.Ratings.Heading      = communityName + " Page Rating";
                communityPage.Ratings.ShowHeading  = true;
                communityPage.Ratings.SendActivity = true;

                //Configure GroupAdmissionBlock
                communityPage.GroupAdmission.GroupName   = communityName;
                communityPage.GroupAdmission.ShowHeading = true;
                communityPage.GroupAdmission.Heading     = communityName + " Admission Form";

                //Configure MembershipBlock
                communityPage.Memberships.GroupName   = communityName;
                communityPage.Memberships.ShowHeading = true;
                communityPage.Memberships.Heading     = communityName + " Member List";
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Eventhandler for PublishedContent that adds the page's ChangedBy
        /// user to a subscription based on the page's ContentLink ID.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnPublishedContent(object sender, EPiServer.ContentEventArgs e)
        {
            var page = e.Content as IChangeTrackable;

            if (page == null)
            {
                return;
            }

            // Create a subscription
            var key  = new Uri(BaseUri, e.Content.ContentLink.ID.ToString());
            var user = new NotificationUser(page.ChangedBy);

            _subscriptionService.SubscribeAsync(key, user).Wait();
        }
        void contentEvents_PublishingContent(object sender, EPiServer.ContentEventArgs e)
        {
            var page = e.Content as StandardPage;

            if (page != null)
            {
                var analyzer = ServiceLocator.Current.GetInstance <ITextServiceAnalyzer>();
                AnalyzeText(analyzer, page);
                return;
            }

            var image = e.Content as ImageFile;

            if (image != null)
            {
                var analyzer = ServiceLocator.Current.GetInstance <IImageAnalyzerService>();
                AnalyzeImage(analyzer, image);
            }
        }
        private void OnPublishedContent(object sender, EPiServer.ContentEventArgs e)
        {
            var page = e.Content as IChangeTrackable;

            if (page != null)
            {
                _notifier.PostNotificationAsync(new NotificationMessage
                {
                    ChannelName = "SomeChannelName",
                    TypeName    = "SomeTypeName",

                    Sender     = new NotificationUser("jojoh"),
                    Recipients = new[]
                    {
                        new NotificationUser("jojoh"),
                        new NotificationUser(page.ChangedBy)
                    },
                    Subject = "Page Published",
                    Content = $"{page.ChangedBy} published the page {e.Content.Name}!"
                });
            }
        }
 private void VulcanCommerceContentSynchronization_RelationsUpdated(object sender, EPiServer.ContentEventArgs e)
 {
     VulcanHandler.Service.IndexContentEveryLanguage(e.ContentLink);
 }
 private void Events_ContentEvent(object sender, EPiServer.ContentEventArgs e)
 {
     OnCommandOutput?.Invoke(this, e);
 }
Exemplo n.º 15
0
 void events_PublishedContent(object sender, EPiServer.ContentEventArgs e)
 {
     RestHook.InvokeRestHooks("content_published", ContentAPiController.ConstructExpandoObject(e.Content));
 }
Exemplo n.º 16
0
 void Service_PublishedContent(object sender, EPiServer.ContentEventArgs e)
 {
     VulcanHandler.Service.IndexContentByLanguage(e.Content);
 }
Exemplo n.º 17
0
 void Service_DeletedContentLanguage(object sender, EPiServer.ContentEventArgs e)
 {
     VulcanHandler.Service.DeleteContentByLanguage(e.Content);
 }