Пример #1
0
        public WebLinkSet(Entity entity, IPortalViewEntity viewEntity, IEnumerable <IWebLink> webLinks)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (viewEntity == null)
            {
                throw new ArgumentNullException("viewEntity");
            }

            if (webLinks == null)
            {
                throw new ArgumentNullException("webLinks");
            }

            Entity     = entity;
            ViewEntity = viewEntity;
            WebLinks   = webLinks.ToArray();

            Copy        = viewEntity.GetAttribute("adx_copy");
            Name        = entity.GetAttributeValue <string>("adx_name");
            Title       = viewEntity.GetAttribute("adx_title");
            DisplayName = entity.GetAttributeValue <string>("adx_display_name");
        }
        public Snippet(Entity entity, IPortalViewEntity viewEntity, ContextLanguageInfo language)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (viewEntity == null)
            {
                throw new ArgumentNullException("viewEntity");
            }

            if (language == null)
            {
                throw new ArgumentNullException("language");
            }

            Entity      = entity;
            Name        = entity.GetAttributeValue <string>("adx_name");
            Value       = viewEntity.GetAttribute("adx_value");
            DisplayName = entity.GetAttributeValue <string>("adx_display_name");

            // set the language name value - fails if the solutions have not been updated, so set LanguageName to null
            this.LanguageName = GetLanguageName(entity, language);
        }
Пример #3
0
        public WebLink(Entity entity, IPortalViewEntity viewEntity, ApplicationPath applicationPath, IEnumerable <IWebLink> childWebLinks = null)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (viewEntity == null)
            {
                throw new ArgumentNullException("viewEntity");
            }

            Entity = entity;

            Description = viewEntity.GetAttribute("adx_description");
            Name        = viewEntity.GetAttribute("adx_name");

            if (applicationPath != null)
            {
                if (applicationPath.ExternalUrl != null)
                {
                    Url        = applicationPath.ExternalUrl;
                    IsExternal = true;
                }
                else
                {
                    Url        = applicationPath.AbsolutePath;
                    IsExternal = false;
                }
            }

            WebLinks = childWebLinks == null?Enumerable.Empty <IWebLink>() : childWebLinks.ToArray();

            ImageAlternateText = entity.GetAttributeValue <string>("adx_imagealttext");
            ImageUrl           = entity.GetAttributeValue <string>("adx_imageurl");
            ImageHeight        = entity.GetAttributeValue <int?>("adx_imageheight");
            ImageWidth         = entity.GetAttributeValue <int?>("adx_imagewidth");
            DisplayImageOnly   = entity.GetAttributeValue <bool?>("adx_displayimageonly").GetValueOrDefault(false);
            Page = entity.GetAttributeValue <EntityReference>("adx_pageid");

            HasImage = !string.IsNullOrEmpty(ImageUrl);

            NoFollow              = !entity.GetAttributeValue <bool?>("adx_robotsfollowlink").GetValueOrDefault(true);
            OpenInNewWindow       = entity.GetAttributeValue <bool?>("adx_openinnewwindow").GetValueOrDefault(false);
            ToolTip               = entity.GetAttributeValue <string>("adx_name");
            DisplayPageChildLinks = entity.GetAttributeValue <bool?>("adx_displaypagechildlinks").GetValueOrDefault(false);
        }
 public IPortalViewAttribute GetAttribute(string attributeLogicalName)
 {
     return(_viewEntity.GetAttribute(attributeLogicalName));
 }