Beispiel #1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            SectionDetail target = obj as SectionDetail;

            if (target == null)
            {
                return(false);
            }

            if (SectionName != target.SectionName)
            {
                return(false);
            }

            if (ParentPath != target.ParentPath)
            {
                return(false);
            }

            if (TemplateTheme != target.TemplateTheme)
            {
                return(false);
            }

            if (!SnippetInfos.Equals(target.SnippetInfos))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Gets a single SectionDetail without any parents.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        public static SectionDetail GetSectionDetail(string path)
        {
            SectionDetail sectionDetail            = null;
            string        sectionDetailXmlFileName = null;

            try
            {
                sectionDetailXmlFileName = String.Format(ContentDeliveryEngineConfig.PathInformation.SectionPathFormat.Path, (path == "/" ? String.Empty : path));

                sectionDetailXmlFileName = Server.MapPath(sectionDetailXmlFileName);
                using (FileStream xmlFile = File.Open(sectionDetailXmlFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete))
                {
                    using (XmlReader xmlReader = XmlReader.Create(xmlFile))
                    {
                        sectionDetail = (SectionDetail)_serializer.Deserialize(xmlReader);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = String.Format("GetSectionDetail(): Unable to load section detail from file \"{0}.\"  The file may not exist or the XML in the file may not be serializable into a valid SectionDetail object.", sectionDetailXmlFileName);
                log.Error(message, ex);
                return(null);
            }
            return(sectionDetail);
        }
Beispiel #3
0
        /// <summary>
        /// Get the all the WebAnalyticsInfos of this section and its parents starting with this section
        /// </summary>
        private IEnumerable <WebAnalyticsInfo> RecursiveGetAnalyticsInfo()
        {
            SectionDetail currSection = this;

            while (currSection != null)
            {
                if (this.WebAnalyticsInfo != null)
                {
                    yield return(currSection.WebAnalyticsInfo);

                    currSection = currSection.Parent;
                }
                else
                {
                    currSection = currSection.Parent;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Get the section details for the content item, load custom analytics,
        /// then add the values to the webAnalyticsFieldFilterDelegates dictionary
        /// </summary>
        protected void RegisterCustomWebAnalytics()
        {
            SectionDetail sectiondetail = SectionDetailFactory.GetSectionDetail(SectionPath);

            // Check sectiondetail to make sure not null!!!!!
            if (sectiondetail != null)
            {
                string   channels = sectiondetail.GetWAChannels();
                string   suites   = sectiondetail.GetWASuites();
                string   group    = sectiondetail.GetWAContentGroups();
                string[] events   = sectiondetail.GetWAEvents().ToArray();
                WebAnalyticsCustomVariableOrEvent[] props = sectiondetail.GetWAProps().ToArray();
                WebAnalyticsCustomVariableOrEvent[] evars = sectiondetail.GetWAEvars().ToArray();

                // If Content Group has a value, add to prop44 and eVar44
                if (!String.IsNullOrEmpty(group))
                {
                    SetWebAnalytics(WebAnalyticsOptions.Props.prop44.ToString(), wbField =>
                    {
                        wbField.Value = group;
                    });
                    SetWebAnalytics(WebAnalyticsOptions.eVars.evar44.ToString(), wbField =>
                    {
                        wbField.Value = group;
                    });
                }

                // Register custom events entered on navon
                foreach (string evn in events)
                {
                    if (!String.IsNullOrEmpty(evn))
                    {
                        SetWebAnalytics(evn, waField =>
                        {
                            waField.Value = "";
                        });
                    }
                }

                // Register custom props entered on navon
                foreach (WebAnalyticsCustomVariableOrEvent prop in props)
                {
                    String propKey   = prop.Key;
                    String propValue = prop.Value;

                    if (!String.IsNullOrEmpty(propKey))
                    {
                        SetWebAnalytics(propKey, waField =>
                        {
                            waField.Value = propValue;
                        });
                    }
                }

                // Register custom evars entered on navon
                foreach (WebAnalyticsCustomVariableOrEvent evar in evars)
                {
                    String evarKey   = evar.Key;
                    String evarValue = evar.Value;

                    if (!String.IsNullOrEmpty(evarKey))
                    {
                        SetWebAnalytics(evarKey, waField =>
                        {
                            waField.Value = evarValue;
                        });
                    }
                }
            }
            else
            {
                log.Debug("RegisterCustomWebAnalytics(): SectionDetails XML not found.");
                return;
            }
        }