public override void OnAfterSubmit(FormData formData, FormSubmittedData submittedFormData, string formXml,
                                       CmsEventArgs eventArgs)
    {
        var formFieldDataItem = submittedFormData.DataItems.ToList().FirstOrDefault(x => x.FieldName == "EktFormId");

        //act upon the form submit results
    }
        public override void OnAfterOrderPlaced(OrderData orderData, CmsEventArgs eventArgs)
        {
            String ToEmail = "*****@*****.**";
            String FromAddress = "*****@*****.**";
            String BodyMessage = String.Format("{2} {3} has placed Order #{0} on {1}", orderData.Id.ToString(),orderData.DateCreated.ToShortDateString(),orderData.Customer.FirstName,orderData.Customer.LastName);
            String Subject = String.Format("Order #{0} has been placed on MSD Powersports", orderData.Id);

            Ektron.Cms.Extensibility.Commerce.MSD.MSDHelperUtilities.SendOrderMail(FromAddress, ToEmail, Subject, BodyMessage);
        }
Esempio n. 3
0
        public override void OnAfterAddContent(Ektron.Cms.ContentData contentData, CmsEventArgs eventArgs)
        {
            var tagger = new BusinessLogic.Content.ContentTagger();

            if (!tagger.HasTags(contentData.Id))
            {
                var alchemyManager = new Alchemy.Concepts.ContentTagging();
                var tagResults     = alchemyManager.GetAlchemyConceptTags(contentData);
                tagger.TagContent(contentData.Id, tagResults);
            }
        }
Esempio n. 4
0
        public override void OnBeforeUpdateContent(ContentData contentData, CmsEventArgs eventArgs)
        {
            if (contentData.FolderId == 163 || contentData.FolderId == 164)
            {
                SmartForm.URLmap.root URLMaps = getURLMaps();

                if (URLMaps.URL_Mappings.Length > 0 && contentData.Html != "")
                {
                    string newHTML = substituteURLs(contentData.Html, URLMaps);
                    contentData.Html = newHTML;
                }
            }
        }
        private static void traverser_TraversingPlaceholder(object sender, CmsEventArgs e)
        {
            if (ignoreChannels != null && !String.IsNullOrEmpty(ignoreChannels[e.Channel.Guid]))
            {
                return;
            }

            // Ignore expired postings
            if (e.Posting.ExpiryDate <= DateTime.Now)
            {
                return;
            }

            Console.WriteLine(e.Posting.UrlModePublished + ": " + e.Placeholder.Name);

            var image = e.Placeholder as ImagePlaceholder;

            if (image != null)
            {
                var resource  = CmsUtilities.ParseResourceUrl(image.Src, e.Context);
                var cmsGroups = CmsPermissions.ReadCmsGroupsForChannel(e.Channel);
                if (cmsGroups[CmsRole.Editor].Count == 0)
                {
                    return;
                }

                IsResourceInTheRightFolder(e, resource, cmsGroups);
            }
            else
            {
                var resourceLinks = Regex.Matches(e.Placeholder.Datasource.RawContent, CmsUtilities.DownloadLinkPattern, RegexOptions.IgnoreCase);
                if (resourceLinks.Count == 0)
                {
                    return;
                }

                var cmsGroups = CmsPermissions.ReadCmsGroupsForChannel(e.Channel);
                if (cmsGroups[CmsRole.Editor].Count == 0)
                {
                    return;
                }

                foreach (Match match in resourceLinks)
                {
                    var resource = CmsUtilities.ParseResourceUrl(match.Groups["url"].Value, e.Context);
                    IsResourceInTheRightFolder(e, resource, cmsGroups);
                }
            }
        }
        public override void OnAfterCalculate(BasketCalculatorData basketCalculatorData, CmsEventArgs eventArgs)
        {
            //Apply tax rate to shipping
            decimal basketSubtotal = basketCalculatorData.Basket.Subtotal;
            decimal basketTotalTaxes = basketCalculatorData.TotalTaxes;
            decimal basketTotalShippingCost = basketCalculatorData.TotalShippingCost;
            decimal taxRate = 0;
            decimal shipTax = 0;
            decimal totalTaxes = 0;

            if (basketSubtotal != 0) {
                taxRate = basketTotalTaxes / basketSubtotal;
                shipTax =  basketTotalShippingCost * taxRate;
                totalTaxes = basketTotalTaxes + shipTax;
                basketCalculatorData.TotalTaxes = totalTaxes;
            }
        }
        private static bool IsResourceInTheRightFolder(CmsEventArgs e, Resource resource, Dictionary <CmsRole, IList <string> > cmsGroups)
        {
            if (resource != null && resource.Parent != null && resource.Parent.Parent != null)
            {
                // Get the resource gallery which should match the name of the CMS group
                var gallery = resource.Parent;
                while (gallery.Parent != null && gallery.Parent.Parent != null && gallery.Parent.Parent != e.Context.RootResourceGallery)
                {
                    gallery = gallery.Parent;
                }

                // Is the resource in a folder named after the group?
                foreach (var cmsGroup in cmsGroups[CmsRole.Editor])
                {
                    if (cmsGroup.ToUpperInvariant() == gallery.Name.ToUpperInvariant())
                    {
                        // It's a match, so no problem here. But save details in case resource used across two groups.
                        if (!resourcesUsed.ContainsKey(resource.Guid))
                        {
                            resourcesUsed.Add(resource.Guid, new ResourceLocation());
                        }
                        if (!resourcesUsed[resource.Guid].BelongsInFolder.Contains(cmsGroup))
                        {
                            resourcesUsed[resource.Guid].BelongsInFolder.Add(cmsGroup);
                        }
                        if (!resourcesUsed[resource.Guid].UsedOnPages.Contains(PostingUrl(e.Posting)))
                        {
                            resourcesUsed[resource.Guid].UsedOnPages.Add(PostingUrl(e.Posting));
                        }
                        return(true);
                    }
                }

                // Getting here means we have a resource and a channel with a web author, but no matching name
                FoundResourceToMove(PostingUrl(e.Posting), resource, cmsGroups);
                return(false);
            }
            return(true);
        }
Esempio n. 8
0
 void traverser_TraversingChannel(object sender, CmsEventArgs e)
 {
     ExtendChannel(this.newExpiry, new Guid(e.Channel.Guid));
 }
        public override void OnAfterPublishContent(ContentData contentData, CmsEventArgs eventArgs)
        {
            //Log.WriteMessage(string.Format("-Begin {0}.OnAfterPublishContent.", CLASS_NAME), LogLevel.Verbose);
            //if (DxHUtils.IsDxHActive())
            //{

            //    if (contentData.Type == (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Content)
            //    {
            //        List<ConnectorFlyWeight> connectorFlyweights = this.ContextBusClient.GetRegisteredAdapterList();
            //        if (connectorFlyweights.Count > 0)
            //        {
            //            AdapterName = connectorFlyweights.FirstOrDefault(x => x.Id.ToLower().Contains("ektron")).Id;
            //            Login();

            //            EventDefinition HTMLDefinition = GetContentHTMLEventDef();

            //            if (HTMLDefinition != null)
            //            {
            //                EventInstance HTMLEventInstance = CreateContentDataEventInstance(HTMLDefinition, contentData);
            //                if (HTMLEventInstance != null)
            //                {
            //                    DxHEventManager.RaiseEvent(HTMLEventInstance);
            //                }
            //            }
            //            else
            //            {
            //                Log.WriteMessage(string.Format("{0}.OnAfterPublishContent could not load an EventDefition.", CLASS_NAME), LogLevel.Verbose);
            //            }
            //            LogOut();
            //        }
            //    }
            //}
            //Log.WriteMessage(string.Format("+Finish {0}.OnAfterPublishContent.", CLASS_NAME), LogLevel.Verbose);
            //base.OnAfterPublishContent(contentData, eventArgs);
        }