예제 #1
0
        public SerializableNode(IPublishedContent content, bool traverseChildren, bool getTemplateAlias = true)
        {
            if (traverseChildren)
                this.Children = content.Children.Select(c => new SerializableNode(c, traverseChildren));
            else
                this.Children = new List<SerializableNode>();

            //this.ContentType = content.ContentType;
            //this.ContentSet = new List<PortableNode>();// content.ContentSet;
            this.CreateDate = content.CreateDate;
            this.CreatorId = content.CreatorId;
            this.CreatorName = content.CreatorName;
            this.DocumentTypeAlias = content.DocumentTypeAlias;
            this.DocumentTypeId = content.DocumentTypeId;
            this.Id = content.Id;
            this.IsDraft = content.IsDraft;
            this.ItemType = content.ItemType;
            this.Level = content.Level;
            this.Name = content.Name;
            //this.Parent = content.Parent;
            this.ParentId = (content.Parent == null) ? -1 : content.Parent.Id;
            this.Path = content.Path;
            //this.Properties = content.Properties;
            //this.Properties = content.Properties.Select(p=>new SerializableProperty(p)).ToList<IPublishedProperty>();// new List<IPublishedProperty>();
            this.PropertiesDictionary = content.Properties.ToDictionary(k => k.PropertyTypeAlias, k => k.DataValue);
            this.SortOrder = content.SortOrder;
            this.TemplateId = content.TemplateId;
            this.TemplateAlias = content.GetTemplateAlias();
            this.UpdateDate = content.UpdateDate;
            this.Url = content.Url;
            this.UrlName = content.UrlName;
            this.Version = content.Version;
            this.WriterId = content.WriterId;
            this.WriterName = content.WriterName;
        }
예제 #2
0
		/// <summary>
		/// Constructor specifying both the IPublishedContent and the CultureInfo
		/// </summary>
		/// <param name="content"></param>
		/// <param name="culture"></param>
		public RenderModel(IPublishedContent content, CultureInfo culture)
		{
            if (content == null) throw new ArgumentNullException("content");
			if (culture == null) throw new ArgumentNullException("culture");
			Content = content;
			CurrentCulture = culture;
		}
예제 #3
0
        public static IEnumerable<NavigationItem> GetIntranetMainNavigation(IPublishedContent root, IPublishedContent current)
        {
            var results = new List<NavigationItem>();

            //results.Add(new NavigationItem()
            //{
            //    Url = "/",
            //    Name = "Hjemmeside",
            //    CssClass = ""
            //});

            results.Add(new NavigationItem()
            {
                Url = umbraco.library.NiceUrl(2120),
                Name = "Forside",
                CssClass = current.Id == 2120 ? "active" : ""
            });

            results.AddRange(root.Children.Select(x => new NavigationItem()
            {
                Url = x.Url,
                Name = x.Name,
                CssClass = current.Id == x.Id ? "active" : ""
            }).ToList());

            return results;
        }
        /// <summary>
        /// Gets the model for the blog post page
        /// </summary>
        /// <param name="currentPage">The current page</param>
        /// <param name="currentMember">The current member</param>
        /// <returns>The page model</returns>
        public BlogPostViewModel GetBlogPostPageModel(IPublishedContent currentPage, IMember currentMember)
        {
            var model = GetPageModel<BlogPostViewModel>(currentPage, currentMember);
            model.ImageUrl = GravatarHelper.CreateGravatarUrl(model.Author.Email, 200, string.Empty, null, null, null);

            return model;
        }
        public void SetUp()
        {
            _archetype = ContentHelpers.Archetype;

            var content = ContentHelpers.FakeContent(123, "Fake Node 1", properties: new Collection<IPublishedProperty>
            {
                new FakePublishedProperty("myArchetypeProperty", _archetype, true)
            });

            _content = new FakeModel(content);
            _propertyDescriptor = TypeDescriptor.GetProperties(_content)["TextString"];

            _context = new FakeDittoValueResolverContext(_content, _propertyDescriptor);

            var mockedPropertyService = new Mock<PropertyValueService>();

            mockedPropertyService.SetupSequence(
                i =>
                    i.Set(It.IsAny<IPublishedContent>(), It.IsAny<CultureInfo>(), It.IsAny<PropertyInfo>(),
                        It.IsAny<object>(), It.IsAny<object>(), It.IsAny<DittoValueResolverContext>()))
                        .Returns(new HtmlString("<p>This is the <strong>summary</strong> text.</p>"))
                        .Returns("Ready to Enroll?")
                        .Returns("{}");

            _sut = new ArchetypeBindingService(mockedPropertyService.Object, new DittoAliasLocator());
        }
예제 #6
0
        /// <summary>
        /// Gets images url list.
        /// 
        /// Gets crops if cropname specified
        /// </summary>
        /// <param name="post"></param>
        /// <param name="cropName"></param>
        /// <returns></returns>
        public static IEnumerable<String> GetImagesUrl(IPublishedContent post, String cropName = "", String fieldAlias = "images")
        {
            List<string> result = new List<string>();

            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);

            try
            {
                var pictureIDsVal = post.GetPropertyValue<String>(fieldAlias);
                if (!String.IsNullOrEmpty(pictureIDsVal))
                {
                    var pictureIDs = pictureIDsVal.Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var pictureIDstr in pictureIDs)
                    {
                        if (!String.IsNullOrEmpty(pictureIDstr))
                        {
                            int id = Int32.Parse(pictureIDstr);
                            var url = GetImageUrl(id, cropName);
                            result.Add(url);
                        }
                    }

                }
            }
            catch (Exception e)
            {
                if (UmbracoContext.Current.IsDebug)
                {
                    //throw e;
                }
            }

            return result;
        }
		/// <summary>
		/// Converts an IPublishedContent instance to SimpleContent.
		/// </summary>
		/// <param name="content">The IPublishedContent instance you wish to convert.</param>
		/// <param name="recurseChildren">Whether to include the children in the SimpleContent instance.</param>
		/// <param name="recurseContentTypes">Whether to include the parent content types on each SimpleContent instance.</param>
		/// <param name="recurseTemplates">Whether to include the parent templates on each SimpleContent instance.</param>
		/// <returns>A SimpleContent representation of the specified IPublishedContent</returns>
		public static SimpleContent FromIPublishedContent(IPublishedContent content, bool recurseChildren = true, bool recurseContentTypes = true, bool recurseTemplates = true) {
			if (content == null) return null;

			/*
			 * Using string, object for key/value pairs.
			 * An object is used so that the JavaScriptSerializer will
			 * automatically detect the type and serialize it to the
			 * correct JavaScript type.
			 */
			var properties =
				content.Properties
				       .Where(p => !String.IsNullOrWhiteSpace(p.Value.ToString()))
				       .ToDictionary(prop => prop.Alias, prop => prop.Value);
			
			var result = new SimpleContent() {
				Id = content.Id,
				Name = content.Name,
				Url = content.Url,
				Level = content.Level,
				Properties = properties,
				ContentType = SimpleContentType.FromContentType(content.DocumentTypeId, recurseContentTypes),
				Template = SimpleTemplate.FromTemplate(content.TemplateId, recurseTemplates),
				ChildrenIds = content.Children.Select(x => x.Id).ToList()
			};

			if (recurseChildren) {
				result.Children = FromIPublishedContent(content.Children, true, recurseContentTypes, recurseTemplates);
			}

			return result;
		}
		public override void Init(IPublishedContent content)
		{
			base.Init(content);
						
			this.HideInBottomNavigation = Content.GetPropertyValue<bool>("umbracoNaviHide");
			
		}
        public static string GetPostCreatorFullName(IPublishedContent member, IPublishedContent post)
        {
            string memberFullName = null;

            if (member != null)
            {
                memberFullName = String.Format("{0} {1}", member.GetPropertyValue<String>("arborFirstName"), member.GetPropertyValue<String>("arborLastName")).Trim();

                if (String.IsNullOrEmpty(memberFullName))
                {
                    memberFullName = String.Format("{0} {1}", member.GetPropertyValue<String>("firstName"), member.GetPropertyValue<String>("lastName")).Trim();
                }

                if (String.IsNullOrEmpty(memberFullName))
                {
                    memberFullName = member.Name;
                }
            }

            if (String.IsNullOrEmpty(memberFullName) && (post != null))
            {
                memberFullName = post.CreatorName;
            }

            if (String.IsNullOrEmpty(memberFullName))
            {
                memberFullName = "Not Available";
            }

            return memberFullName;
        }
 public string GetMediaUrl(IPublishedContent node, string mediaProperty)
 {
     var linkMedia = _umbracoHelper.TypedMedia(node.GetPropertyValue<int>(mediaProperty));
     if (linkMedia != null)
         return linkMedia.GetPropertyValue<string>(MEDIA_FILE_PROPERTY);
     return string.Empty;
 }
 /// <summary>
 /// Initializes a new instance based on the specified <code>content</code>.
 /// </summary>
 /// <param name="content">An instance of <see cref="IPublishedContent"/> representing the selected image.</param>
 protected ImagePickerImage(IPublishedContent content) {
     Image = content;
     Width = content.GetPropertyValue<int>(global::Umbraco.Core.Constants.Conventions.Media.Width);
     Height = content.GetPropertyValue<int>(global::Umbraco.Core.Constants.Conventions.Media.Height);
     Url = content.Url;
     CropUrl = content.GetCropUrl(Width, Height, preferFocalPoint: true, imageCropMode: ImageCropMode.Crop);
 }
예제 #12
0
        protected Frontpage(IPublishedContent content)
            : base(content)
        {
            IPublishedContent skills = content.Children.FirstOrDefault(x => x.DocumentTypeAlias == "Skills");
            IPublishedContent portfolio = content.Children.FirstOrDefault(x => x.DocumentTypeAlias == "Portfoliolist");
            IPublishedContent contact = content.Children.FirstOrDefault(x => x.DocumentTypeAlias == "Contact");

            Sliders = ArcheTypeSlider.GetFromContent(content.GetPropertyValue<ArchetypeModel>("sliders"));

            KompetencerHeadline = skills.GetPropertyValue<string>("title");
            KompetencerText = skills.GetPropertyValue<string>("content");
            Kompetencer = ArchetypeSkill.GetFromContent(skills.GetPropertyValue<ArchetypeModel>("skills"));

            PortfolioHeadline = portfolio.GetPropertyValue<string>("title");
            PortfolioItems = content
                .Descendants("PortfolioPage")
                .Where(x => !x.Hidden())
                .Select(PortfolioItem.GetFromContent);

            KontaktHeadline = contact.GetPropertyValue<string>("title");
            KontaktTeaser = contact.GetPropertyValue<string>("teaser");
            KontaktForm = contact.GetPropertyValue<string>("form");

            AdrHeadline = contact.GetPropertyValue<string>("adrHeadline");
            AdrShortText = contact.GetPropertyValue<string>("adrShortText");
            AdrCompany = contact.GetPropertyValue<string>("adrCompany");
            AdrAddress = contact.GetPropertyValue<string>("adrAddress");
            AdrZip = contact.GetPropertyValue<string>("adrZip");
            AdrCity = contact.GetPropertyValue<string>("adrCity");
            AdrMobile = contact.GetPropertyValue<string>("adrMobile");
            AdrEmail = contact.GetPropertyValue<string>("adrEmail");
        }
 private static IEnumerable<Tuple<IPublishedContent, dynamic>> GetBranch(IPublishedContent document)
 {
     IEnumerable<IPublishedContent> children = document.GetPropertyValue<bool>("excludeChildrenFromSiteMap") ?
         Enumerable.Empty<IPublishedContent>() :
         document.Children.Where(x => !x.GetPropertyValue<bool>("excludeFromSiteMap") && x.HasProperty("excludeFromSiteMap")).ToArray();
     return from child in children select Tuple.Create<IPublishedContent, dynamic>(child, GetBranch(child));
 }
        /// <summary>
        /// Gets the model for the contact page
        /// </summary>
        /// <param name="currentPage">The current page</param>
        /// <param name="currentMember">The current member</param>
        /// <returns>The page model</returns>
        public ContactViewModel GetContactPageModel(IPublishedContent currentPage, IMember currentMember)
        {
            var model = GetPageModel<ContactViewModel>(currentPage, currentMember);
            Mapper.Map(currentPage, model.Form);

            return model;
        }
        public static HtmlString RenderDocTypeGridEditorItem(this HtmlHelper helper,
            IPublishedContent content,
            string viewPath = "",
            string actionName = "",
            object model = null)
        {
            if (content == null)
                return new HtmlString(string.Empty);

            var controllerName = content.DocumentTypeAlias + "Surface";

            if (!string.IsNullOrWhiteSpace(viewPath))
                viewPath = viewPath.TrimEnd('/') + "/";

            if (string.IsNullOrWhiteSpace(actionName))
                actionName = content.DocumentTypeAlias;

            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
            if (umbracoHelper.SurfaceControllerExists(controllerName, actionName, true))
            {
                return helper.Action(actionName, controllerName, new
                {
                    dtgeModel = model ?? content,
                    dtgeViewPath = viewPath
                });
            }

            if (!string.IsNullOrWhiteSpace(viewPath))
                return helper.Partial(viewPath + content.DocumentTypeAlias + ".cshtml", content);

            return helper.Partial(content.DocumentTypeAlias, content);
        }
        /// <summary>
        /// Given the set of replacement values and a list of property aliases
        /// of the email fields, construct and send the required emails.
        /// </summary>
        /// <param name="emailValues">The replacement values</param>
        /// <param name="formAliases">The node property aliases, relevant to the current node.</param>
        protected void ProcessForms(Dictionary<string, string> emailValues, IPublishedContent content, EmailType emailType, params string[] formAliases)
        {
            // process each of the given property names, retrieving the form data,
            // replacing placeholders, and sending the email.
            foreach (var alias in formAliases)
            {
                var prop = content.GetPropertyValue<string>(alias, true, string.Empty);
                if (prop != null)
                {
                    var emailFields = DEF_Helper.GetFields(prop);

                    if (emailFields.Send)
                    {
                        ReplacePlaceholders(emailFields, emailValues);
                        emailFields.Body = AddImgAbsolutePath(emailFields.Body);
                        Umbraco.SendEmail(
                            emailFields.SenderEmail,
                            emailFields.SenderName,
                            emailFields.ReceiverEmail,
                            emailFields.Subject,
                            emailFields.Body,
                            emailFields.CCEmail,
                            emailFields.BCCEmail,
                            emailType: emailType
                            );
                    }
                }
            }
        }
예제 #17
0
            public ConvertedNode(IPublishedContent doc)
            {
                _doc = doc;

                if (doc == null)
                {
                    Id = 0;
                    return;
                }

                template = doc.TemplateId;
                Id = doc.Id;
                Path = doc.Path;
                CreatorName = doc.CreatorName;
                SortOrder = doc.SortOrder;
                UpdateDate = doc.UpdateDate;
                Name = doc.Name;
                NodeTypeAlias = doc.DocumentTypeAlias;
                CreateDate = doc.CreateDate;
                CreatorID = doc.CreatorId;
                Level = doc.Level;
                UrlName = doc.UrlName;
                Version = doc.Version;
                WriterID = doc.WriterId;
                WriterName = doc.WriterName;
            }
 private static object CreateMagicModel(Type genericType, IPublishedContent content)
 {
     var contentType = content.GetType();
     var modelType = genericType.MakeGenericType(contentType);
     var model = Activator.CreateInstance(modelType, content);
     return model;
 }
예제 #19
0
		public override void Init(IPublishedContent content)
		{
			base.Init(content);
						
			this.Name = Content.GetPropertyValue<string>("name");
			
		}
        public virtual void HandleSubmission(FormModel model, IPublishedContent content)
        {
            var cookieValue = (Request.Cookies.AllKeys.Contains(FormSubmittedCookieKey) ? Request.Cookies[FormSubmittedCookieKey].Value : null) ?? string.Empty;
            var containsCurrentContent = cookieValue.Contains(FormSubmittedCookieValue(content));

            if(model.DisallowMultipleSubmissionsPerUser == false)
            {
                if(containsCurrentContent)
                {
                    // "only one submission per user" must've been enabled for this form at some point - explicitly remove the content ID from the cookie
                    cookieValue = cookieValue.Replace(FormSubmittedCookieValue(content), ",");
                    if(cookieValue == ",")
                    {
                        // this was the last content ID - remove the cookie
                        Response.Cookies.Add(new HttpCookie(FormSubmittedCookieKey, cookieValue) { Expires = DateTime.Today.AddDays(-1) });
                    }
                    else
                    {
                        // update the cookie value
                        Response.Cookies.Add(new HttpCookie(FormSubmittedCookieKey, cookieValue) { Expires = DateTime.Today.AddDays(30) });
                    }
                }

                return;
            }

            // add the content ID to the cookie value if it's not there already
            if(containsCurrentContent == false)
            {
                cookieValue = string.Format("{0}{1}", cookieValue.TrimEnd(','), FormSubmittedCookieValue(content));
            }
            Response.Cookies.Add(new HttpCookie(FormSubmittedCookieKey, cookieValue) { Expires = DateTime.Today.AddDays(30) });
        }
        /// <summary>
        /// Generates css class for current node from its doctype and name
        /// </summary>
        /// <param name="currentNode"></param>
        /// <returns>
        /// Doctypes: post, category, homepage, other-type
        /// </returns>
        public static String GenerateCSSClass(IPublishedContent currentNode)
        {
            //TODO: solve multilanguage issue (url names will differ for same pages)
            String result = "other-type";

            if (currentNode != null)
            {
                var typeService = ApplicationContext.Current.Services.ContentTypeService;
                IContentType nodeType = typeService.GetContentType(currentNode.DocumentTypeAlias);
                if (nodeType != null)
                {
                    if (
                        nodeType.ContentTypeCompositionExists("Category") ||
                        currentNode.DocumentTypeAlias == "Category" ||
                        currentNode.DocumentTypeAlias == "SearchResults" ||
                        currentNode.DocumentTypeAlias == "List"
                        )
                    {
                        result = "category";
                    }
                    else if (
                        nodeType.ContentTypeCompositionExists("Homepage") ||
                        currentNode.DocumentTypeAlias == "Homepage"
                        )
                    {
                        result = "homepage";
                    }
                    else if (
                        nodeType.ContentTypeCompositionExists("SimplePage") ||
                        currentNode.DocumentTypeAlias == "Contact" ||
                        currentNode.DocumentTypeAlias == "ListElement" ||
                        currentNode.DocumentTypeAlias == "SimplePage" ||
                        currentNode.DocumentTypeAlias == "Site_Infographic"
                        )
                    {
                        result = "post";
                    }
                }
                IEnumerable<IPublishedContent> ancestors = currentNode.AncestorsOrSelf();
                foreach (IPublishedContent ancestor in ancestors)
                {
                    if (ancestor.Level > 0)
                    {
                        result += " con_" + ancestor.UrlName;
                    }
                }

                //add document type
                var projectPrefixes = new string[] {"Site_", "Academy_", "Creative_" };
                var doctypeName = currentNode.DocumentTypeAlias;
                foreach (var prefix in projectPrefixes)
                {
                    doctypeName = doctypeName.Replace(prefix, "");
                }
                doctypeName = Regex.Replace(doctypeName, "(\\B[A-Z])", "-$1");
                doctypeName = doctypeName.ToCharArray()[0] == '-' ? doctypeName.Substring(1) : doctypeName ;
                result += " doc_" + doctypeName.ToLower().Replace(" ", "-").Replace("_", "");
            }
            return result;
        }
 /// <summary>
 /// Method to get the model for the footer navigation
 /// </summary>
 /// <param name="currentPage">Current page</param>
 /// <returns>Navigation model</returns>
 public NavigationViewModel GetFooterNavigation(IPublishedContent currentPage)
 {
     return new NavigationViewModel
     {
         Items = GetMenuItems(currentPage, PropertyAliases.FooterNavigation)
     };
 }
		public override void Init(IPublishedContent content)
		{
			base.Init(content);
						
			this.Authors = Content.GetPropertyValue<string>("authors");
			
		}
        /// <summary>
        /// Creates a strongly-typed model representing a published content.
        /// </summary>
        /// <param name="content">The original published content.</param>
        /// <returns>
        /// The strongly-typed model representing the published content, or the published content
        /// itself it the factory has no model for that content type.
        /// </returns>
        public IPublishedContent CreateModel(IPublishedContent content)
        {
            // HACK: [LK:2014-12-04] It appears that when a Save & Publish is performed in the back-office, the model-factory's `CreateModel` is called.
            // This can cause a null-reference exception in specific cases, as the `UmbracoContext.PublishedContentRequest` might be null.
            // Ref: https://github.com/leekelleher/umbraco-ditto/issues/14
            if (UmbracoContext.Current == null || UmbracoContext.Current.PublishedContentRequest == null)
            {
                return content;
            }

            if (this.converterCache == null)
            {
                return content;
            }

            var contentTypeAlias = content.DocumentTypeAlias;
            Func<IPublishedContent, IPublishedContent> converter;

            if (!this.converterCache.TryGetValue(contentTypeAlias, out converter))
            {
                return content;
            }

            return converter(content);
        }
예제 #25
0
        /// <summary>
        /// Builds a <see cref="ILinkTier"/>
        /// </summary>
        /// <param name="tierItem">The <see cref="IPublishedContent"/> "tier" item (the parent tier)</param>
        /// <param name="current">The current <see cref="IPublishedContent"/> in the recursion</param>
        /// <param name="excludeDocumentTypes">A collection of document type aliases to exclude</param>
        /// <param name="tierLevel">The starting "tier" level. Note this is the Umbraco node level</param>
        /// <param name="maxLevel">The max "tier" level. Note this is the Umbraco node level</param>
        /// <param name="includeContentWithoutTemplate">True or false indicating whether or not to include content that does not have an associated template</param>
        /// <returns>the <see cref="ILinkTier"/></returns>
        public ILinkTier BuildLinkTier(IPublishedContent tierItem, IPublishedContent current, string[] excludeDocumentTypes = null, int tierLevel = 0, int maxLevel = 0, bool includeContentWithoutTemplate = false)
        {
            var active = current.Path.Contains(tierItem.Id.ToString(CultureInfo.InvariantCulture));

            if (current.Level == tierItem.Level) active = current.Id == tierItem.Id;

            var tier = new LinkTier()
            {
                ContentId = tierItem.Id,
                ContentTypeAlias = tierItem.DocumentTypeAlias,
                Title = tierItem.Name,
                Url = ContentHasTemplate(tierItem) ? tierItem.Url : string.Empty,
                CssClass = active ? "active" : string.Empty
            };

            if (excludeDocumentTypes == null) excludeDocumentTypes = new string[] { };

            if (tierLevel > maxLevel && maxLevel != 0) return tier;

            foreach (var item in tierItem.Children.ToList().Where(x => x.IsVisible() && (ContentHasTemplate(x) || (includeContentWithoutTemplate && x.IsVisible())) && !excludeDocumentTypes.Contains(x.DocumentTypeAlias)))
            {
                var newTier = BuildLinkTier(item, current, excludeDocumentTypes, item.Level, maxLevel);

                if (AddingTier != null)
                {
                    AddingTier.Invoke(this, new AddingLinkTierEventArgs(tier, newTier));    
                }
                                
                tier.Children.Add(newTier);
            }

            return tier;
        }
예제 #26
0
 public static string GetImageUrl(this UmbracoContext context, IPublishedContent node, string propertyName)
 {
     var helper = new UmbracoHelper(context);
     var imageId = node.GetPropertyValue<int>(propertyName);
     var typedMedia = helper.TypedMedia(imageId);
     return typedMedia != null ? typedMedia.Url : null;
 }
예제 #27
0
        /// <summary>
        /// Maps the image model from the media node
        /// </summary>
        /// <param name="mapper">Umbraco mapper</param>
        /// <param name="media">Media node</param>
        /// <returns>Image model</returns>
        public static object GetImage(IUmbracoMapper mapper, IPublishedContent media)
        {
            var image = GetModel<ImageViewModel>(mapper, media);
            MapImageCrops(media, image);

            return image;
        }
예제 #28
0
        private void AddCountryToDataSet(ResultData resultData, IPublishedContent landkosten, string goalCurrency, String localizedYear)
        {
            var kostenland = new CountryCost(landkosten, goalCurrency);

            for (int i = 1; i <= 20; i++)
            {

                int jaarTakseInGoalCurrency = kostenland.GetYear(i) ?? default(int);

                if (jaarTakseInGoalCurrency > resultData.MaxTakse)
                {
                    resultData.MaxTakse = jaarTakseInGoalCurrency;
                }

                resultData.AddDataPoint(i, jaarTakseInGoalCurrency, localizedYear);
            }

            string stepWidthString = (resultData.MaxTakse / 10).ToString();
            int biggestInt = Convert.ToInt32(stepWidthString[0].ToString()) + 1;
            string nextBigNumberforStep = biggestInt.ToString();

            for (int i = 0; i < stepWidthString.Length - 1; i++)
            {
                nextBigNumberforStep += "0";
            }

            int nextBigNumberForStepInt = Convert.ToInt32(nextBigNumberforStep);
            resultData.StepWidth = nextBigNumberForStepInt;
        }
예제 #29
0
 /// <summary>
 /// Gets the path to the currently assigned theme.
 /// </summary>
 /// <param name="model">
 /// The <see cref="IMasterModel"/>.
 /// </param>
 /// <returns>
 /// The <see cref="string"/> representing the path to the starter kit theme folder.
 /// </returns>
 public static string GetThemePath(IPublishedContent model)
 {
     const string Path = "~/App_Plugins/Merchello.Bazaar/Themes/{0}/";
     return model.HasProperty("theme") && model.HasValue("theme") ? 
         string.Format(Path, model.GetPropertyValue<string>("theme")) :
         string.Empty;
 }
예제 #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductOptionWrapper"/> class.
        /// </summary>
        /// <param name="display">
        /// The display.
        /// </param>
        /// <param name="_parent">
        /// The parent content.
        /// </param>
        /// <param name="contentType">
        /// The content Type.
        /// </param>
        public ProductOptionWrapper(ProductOptionDisplay display, IPublishedContent _parent, PublishedContentType contentType = null)
        {
            _display = display;
            _contentType = contentType;

            Initialize(_parent);
        }
예제 #31
0
#pragma warning restore 0109

        // ctor
        public Image(IPublishedContent content)
            : base(content)
        {
        }
예제 #32
0
#pragma warning restore 0109

        public MainArtiles(IPublishedContent content)
            : base(content)
        {
        }
예제 #33
0
#pragma warning restore 0109

        public ContactUs(IPublishedContent content)
            : base(content)
        {
        }
예제 #34
0
#pragma warning restore 0109

        // ctor
        public SignIn(IPublishedContent content)
            : base(content)
        {
        }
예제 #35
0
#pragma warning restore 0109

        // ctor
        public Member(IPublishedContent content)
            : base(content)
        {
        }
예제 #36
0
#pragma warning restore 0109

        // ctor
        public Home(IPublishedContent content)
            : base(content)
        {
        }
예제 #37
0
#pragma warning restore 0109

        // ctor
        public File(IPublishedContent content)
            : base(content)
        {
        }
예제 #38
0
#pragma warning restore 0109

        // ctor
        public Cards(IPublishedContent content)
            : base(content)
        {
        }
예제 #39
0
#pragma warning restore 0109

        // ctor
        public Titel(IPublishedContent content)
            : base(content)
        {
        }
예제 #40
0
#pragma warning restore 0109

        // ctor
        public Folder(IPublishedContent content)
            : base(content)
        {
        }
 /// <inheritdoc />
 public bool TryGetValue <T>(IPublishedContent content, string alias, string?culture, string?segment, Fallback fallback, T defaultValue, out T?value, out IPublishedProperty?noValueProperty)
 {
     value           = default;
     noValueProperty = default;
     return(false);
 }
예제 #42
0
#pragma warning restore 0109

        // ctor
        public Logo(IPublishedContent content)
            : base(content)
        {
        }
예제 #43
0
#pragma warning restore 0109

        public Product(IPublishedContent content)
            : base(content)
        {
        }
예제 #44
0
#pragma warning restore 0109

        // ctor
        public Event(IPublishedContent content)
            : base(content)
        {
        }
예제 #45
0
#pragma warning restore 0109

        public ContentPage(IPublishedContent content)
            : base(content)
        {
        }
#pragma warning restore 0109

        public People(IPublishedContent content)
            : base(content)
        {
        }
예제 #47
0
#pragma warning restore 0109

        public NavigationBase(IPublishedContent content)
            : base(content)
        {
        }
예제 #48
0
#pragma warning restore 0109

        public Person(IPublishedContent content)
            : base(content)
        {
        }
예제 #49
0
        /// <inheritdoc/>
        public override object Map(IPublishedContent content, object value)
        {
            value = value is Picker picker ? picker.SavedValue : value;

            return(base.Map(content, value));
        }
예제 #50
0
#pragma warning restore 0109

        public Blogpost(IPublishedContent content)
            : base(content)
        {
        }
#pragma warning restore 0109

        public IndividualJobPage(IPublishedContent content)
            : base(content)
        {
        }
예제 #52
0
#pragma warning restore 0109

        public Feature(IPublishedContent content)
            : base(content)
        {
        }
        public static IEnumerable <IPublishedContent> ListViewOrTreeChildren(this IPublishedContent content, bool isListView, string alias = null)
        {
            var contentTypeAliases = content.FindListViewContentTypeAliases(alias);

            return(content.Children(c => contentTypeAliases.IsInListView(c.DocumentTypeAlias) == isListView));
        }
예제 #54
0
#pragma warning restore 0109

        public Post(IPublishedContent content)
            : base(content)
        {
        }
 public static IEnumerable <IPublishedContent> ListViewChildren(this IPublishedContent content, string alias = null)
 {
     return(content.ListViewOrTreeChildren(true, alias));
 }
예제 #56
0
 internal DynamicPublishedContent(IPublishedContent content, DynamicPublishedContentList contentList)
 {
     PublishedContent = content;
     _contentList     = contentList;
 }
예제 #57
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public List <UserGroupPermissionsPoco> GetRecursivePermissionsForNode(IPublishedContent node)
        {
            List <UserGroupPermissionsPoco> permissions = GetPermissionsForNode(node);

            return(permissions);
        }
 public static IEnumerable <IPublishedContent> TreeChildren(this IPublishedContent content)
 {
     return(content.ListViewOrTreeChildren(false));
 }
 // ctor
 public UmbracoMediaAudio(IPublishedContent content, IPublishedValueFallback publishedValueFallback)
     : base(content, publishedValueFallback)
 {
     _publishedValueFallback = publishedValueFallback;
 }
 public static ITemplate GetTemplate(this IPublishedContent content)
 {
     return(ApplicationContext.Current.Services.FileService.GetTemplate(content.TemplateId));
 }