• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IPublishedContent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPublishedContent的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent类的具体用法?C# IPublishedContent怎么用?C# IPublishedContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPublishedContent类属于命名空间,在下文中一共展示了IPublishedContent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetBlogPostPageModel

        /// <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;
        }
开发者ID:robertpurcell,项目名称:UmbracoSandbox,代码行数:13,代码来源:BlogPostPageHandler.cs


示例2: FromIPublishedContent

		/// <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;
		}
开发者ID:Nicholas-Westby,项目名称:rhythm.umbraco.extensions,代码行数:39,代码来源:SimpleContent.cs


示例3: SetUp

        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());
        }
开发者ID:Nicholas-Westby,项目名称:Ditto.Resolvers,代码行数:26,代码来源:ArchetypeBindingServiceTests.cs


示例4: ImagePickerImage

 /// <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);
 }
开发者ID:skybrud,项目名称:Skybrud.ImagePicker,代码行数:11,代码来源:ImagePickerImage.cs


示例5: GetPostCreatorFullName

        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;
        }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:31,代码来源:SimpilyForumHelper.cs


示例6: RenderDocTypeGridEditorItem

        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);
        }
开发者ID:nvisage-gf,项目名称:umbraco-doc-type-grid-editor,代码行数:32,代码来源:HtmlHelperExtensions.cs


示例7: GetBranch

 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));
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:7,代码来源:Unico.Etechno.SiteMapHelper.cs


示例8: Init

		public override void Init(IPublishedContent content)
		{
			base.Init(content);
						
			this.Authors = Content.GetPropertyValue<string>("authors");
			
		}
开发者ID:ismailmayat,项目名称:umbraco.examine.linq,代码行数:7,代码来源:AuthorsRepository.cs


示例9: AddCountryToDataSet

        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;
        }
开发者ID:rubenski,项目名称:pvista,代码行数:29,代码来源:CountryDataController.cs


示例10: CreateModel

        /// <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);
        }
开发者ID:robertjf,项目名称:umbraco-ditto,代码行数:33,代码来源:DittoPublishedContentModelFactory.cs


示例11: BuildLinkTier

        /// <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;
        }
开发者ID:naepalm,项目名称:Buzz.Hybrid,代码行数:43,代码来源:LinkHelper.cs


示例12: GetImage

        /// <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;
        }
开发者ID:robertpurcell,项目名称:UmbracoSandbox,代码行数:13,代码来源:MediaMapper.cs


示例13: GetImageUrl

 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;
 }
开发者ID:kenballard,项目名称:NuthinButNet,代码行数:7,代码来源:ImageHelpers.cs


示例14: GetThemePath

 /// <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;
 }
开发者ID:drpeck,项目名称:Merchello,代码行数:16,代码来源:PathHelper.cs


示例15: ConvertedNode

            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;
            }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:26,代码来源:CompatibilityHelper.cs


示例16: GetFooterNavigation

 /// <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)
     };
 }
开发者ID:robertpurcell,项目名称:UmbracoSandbox,代码行数:12,代码来源:NavigationHandler.cs


示例17: GetContactPageModel

        /// <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;
        }
开发者ID:robertpurcell,项目名称:UmbracoSandbox,代码行数:13,代码来源:ContactPageHandler.cs


示例18: ProductOptionWrapper

        /// <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);
        }
开发者ID:jlarc,项目名称:Merchello,代码行数:19,代码来源:ProductOptionWrapper.cs


示例19: Frontpage

        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");
        }
开发者ID:pjengaard,项目名称:idebankDk,代码行数:32,代码来源:Frontpage.cs


示例20: HandleSubmission

        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) });
        }
开发者ID:alecrt,项目名称:FormEditor,代码行数:33,代码来源:MaxSubmissionsForCurrentUserHandler.cs



注:本文中的IPublishedContent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPublisher类代码示例发布时间:2022-05-24
下一篇:
C# IPublishable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap