当前位置: 首页>>代码示例>>C#>>正文


C# ContentItem类代码示例

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


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

示例1: WriteChild

 protected virtual void WriteChild(XmlTextWriter writer, ContentItem child)
 {
     using (ElementWriter childElement = new ElementWriter("child", writer))
     {
         childElement.WriteAttribute("id", child.ID);
     }
 }
开发者ID:Jobu,项目名称:n2cms,代码行数:7,代码来源:ChildXmlWriter.cs

示例2: Read

 public void Read(XPathNavigator navigator, ContentItem item, ReadingJournal journal)
 {
     foreach (XPathNavigator detailCollectionElement in EnumerateChildren(navigator))
     {
         ReadDetailCollection(detailCollectionElement, item, journal);
     }
 }
开发者ID:Jobu,项目名称:n2cms,代码行数:7,代码来源:DetailCollectionXmlReader.cs

示例3: AppendCreatorNode

		/// <summary>Appends the creator node to the given collection.</summary>
		/// <param name="items"></param>
		/// <param name="engine"></param>
		/// <param name="parent"></param>
		/// <returns></returns>
		public static IEnumerable<ContentItem> AppendCreatorNode(this IEnumerable<ContentItem> items, IEngine engine, ContentItem parent)
		{
			if (parent.ID == 0)
				return items;

			return items.Union(new[] { new CreatorItem(engine, parent) });
		}
开发者ID:rajeshpillai,项目名称:n2cms,代码行数:12,代码来源:EditExtensions.cs

示例4: Attachment

		public Attachment(IAttachmentHandler handler, string url, ContentItem enclosingItem, byte[] fileContents)
		{
			_handler = handler;
			_url = url;
			_enclosingItem = enclosingItem;
			_fileContents = fileContents;
		}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:7,代码来源:Attachment.cs

示例5: Navigate

		public virtual ContentItem Navigate(ContentItem startingPoint, string path)
		{
			return startingPoint.GetChild(path)
				?? sources.ResolvePath(startingPoint, path).CurrentItem
				?? virtualNodes.Get(startingPoint.Path + path.TrimStart('/'))
				?? virtualNodes.Get(path);
		}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:7,代码来源:Navigator.cs

示例6: Read

 public void Read(System.Xml.XPath.XPathNavigator navigator, ContentItem item, ReadingJournal journal)
 {
     foreach (XPathNavigator detailElement in EnumerateChildren(navigator))
     {
         ReadProperty(detailElement, item, journal);
     }
 }
开发者ID:Jobu,项目名称:n2cms,代码行数:7,代码来源:PersistablePropertyXmlReader.cs

示例7: Write

		internal static void Write(HierarchyNode<ContentItem> hierarchy, ContentItem selectedItem, IContentAdapterProvider adapters, ItemFilter filter, string selectableTypes, string selectableExtensions, bool excludeRoot, string target, TextWriter writer)
		{
			N2.Web.Tree.Using(hierarchy)
				.OpenTo(selectedItem)
				.Filters(filter)
				.IdProvider(n => "u" + n.Current.ID, n => "l" + n.Current.ID)
				.LinkWriter((n, w) =>
				{
					BuildLink(adapters.ResolveAdapter<NodeAdapter>(n.Current), n.Current, n.Current.Path == selectedItem.Path, target, IsSelectable(n.Current, selectableTypes, selectableExtensions)).WriteTo(w);
					if (n.Children.Count == 0 && adapters.ResolveAdapter<NodeAdapter>(n.Current).HasChildren(n.Current, filter))
					{
						var ul = new TagBuilder("ul");
						ul.AddCssClass("ajax");
						w.Write(ul.ToString(TagRenderMode.StartTag));

						var li = new TagBuilder("li");
						li.InnerHtml = "{url:" + Url.ParseTokenized("{ManagementUrl}/Content/Navigation/LoadTree.ashx")
							.AppendQuery("target", target)
							.AppendQuery(SelectionUtility.SelectedQueryKey, HttpUtility.UrlEncode(n.Current.Path))
							.AppendQuery("selectableTypes", selectableTypes)
							.AppendQuery("selectableExtensions", selectableExtensions)
							+ "}";
						w.Write(li.ToString());

						w.Write(ul.ToString(TagRenderMode.EndTag));
					}
				})
				.ExcludeRoot(excludeRoot)
				.WriteTo(writer);
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:30,代码来源:TreeUtility.cs

示例8: IsVersionable

        /// <summary>Checks whether an item  may have versions.</summary>
        /// <param name="item">The item to check.</param>
        /// <returns>True if the item is allowed to have versions.</returns>
        public bool IsVersionable(ContentItem item)
        {
            var versionables = (VersionableAttribute[])item.GetContentType().GetCustomAttributes(typeof(VersionableAttribute), true);
            bool isVersionable = versionables.Length == 0 || versionables[0].Versionable == N2.Definitions.AllowVersions.Yes;

            return isVersionable;
        }
开发者ID:spmason,项目名称:n2cms,代码行数:10,代码来源:VersionManager.cs

示例9: ViewPageResult

 public ViewPageResult(ContentItem thePage, IControllerMapper controllerMapper, IWebContext webContext, IActionInvoker actionInvoker)
 {
     _thePage = thePage;
     _controllerMapper = controllerMapper;
     _webContext = webContext;
     _actionInvoker = actionInvoker;
 }
开发者ID:dpawatts,项目名称:zeus,代码行数:7,代码来源:ViewPageResult.cs

示例10: Match

 public override bool Match(ContentItem item)
 {
     foreach (ItemFilter filter in filters)
         if (!filter.Match(item))
             return false;
     return true;
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:7,代码来源:AllFilter.cs

示例11: ReorderChildren

		/// <summary>Reorders children according to OrderBy.</summary>
		/// <param name="item">The item whose children to re-order.</param>
		/// <returns>Items that were changed in the process of ordering. These items needs to be saved for the order to be persisted.</returns>
		public virtual IEnumerable<ContentItem> ReorderChildren(ContentItem item)
		{
			switch (OrderBy)
			{
				case SortBy.Updated:
					return ReorderBy(item, "Updated");
				case SortBy.UpdatedDescending:
					return ReorderBy(item, "Updated DESC");
				case SortBy.CurrentOrder:
					return Utility.UpdateSortOrder(item.Children);
				case SortBy.Expression:
					return ReorderBy(item, SortExpression);
				case SortBy.Published:
					return ReorderBy(item, "Published");
				case SortBy.PublishedDescending:
					return ReorderBy(item, "Published DESC");
				case SortBy.Title:
					return ReorderBy(item, "Title");
				case SortBy.Unordered:
				case SortBy.Append:
					return Enumerable.Empty<ContentItem>();
				default:
					throw new ArgumentException("Unknown sort order: " + OrderBy);
			}
		}
开发者ID:andy4711,项目名称:n2cms,代码行数:28,代码来源:SortChildrenAttribute.cs

示例12: Tree

		/// <summary>Creates a navigation using unordered list elements.</summary>
		public static N2.Web.Tree Tree(this HtmlHelper html,
			ContentItem startsFrom = null,
			ContentItem current = null,
			int takeLevels = 2,
			bool parallelRoot = true,
			bool appendCreatorNode = false,
			ItemFilter filter = null,
			object htmlAttributes = null)
		{
			if (startsFrom == null) startsFrom = html.StartPage();
			if (current == null) current = html.CurrentPage();
			if (filter == null) filter = new NavigationFilter(html.ViewContext.HttpContext.User, html.ContentEngine().SecurityManager);

			var builder = parallelRoot
				? (HierarchyBuilder)new ParallelRootHierarchyBuilder(startsFrom, takeLevels)
				: (HierarchyBuilder)new TreeHierarchyBuilder(startsFrom, takeLevels);

			if (builder == null)
				throw new ArgumentException("builder == null");

			if (appendCreatorNode && ControlPanelExtensions.GetControlPanelState(html).IsFlagSet(ControlPanelState.DragDrop))
				builder.GetChildren = (i) => i == null ? null : i.Children.FindNavigatablePages().Where(filter).AppendCreatorNode(html.ContentEngine(), i);
			else
				builder.GetChildren = (i) => i == null ? null : i.Children.FindNavigatablePages().Where(filter);

			var tree = N2.Web.Tree.Using(builder);
			if (htmlAttributes != null)
				tree.Tag(ApplyToRootUl(htmlAttributes));

			ClassifyAnchors(startsFrom, current, parallelRoot, tree);

			return tree;
		}
开发者ID:rajeshpillai,项目名称:n2cms,代码行数:34,代码来源:HtmlExtensions.cs

示例13: CopyAutoImplementedProperties

 private static void CopyAutoImplementedProperties(ContentItem source, ContentItem destination)
 {
     foreach (var property in source.GetContentType().GetProperties().Where(pi => pi.IsInterceptable()))
     {
         destination[property.Name] = TryClone(source[property.Name]);
     }
 }
开发者ID:nicklv,项目名称:n2cms,代码行数:7,代码来源:VersioningExtensions.cs

示例14: UpdateContentItemAction

        public UpdateContentItemAction(IView view, IController con, ContentItem item, PropertyDescriptor property, object previousValue)
        {
            _view = view;
            _con = con;

            _state = ContentItemState.Get(item);

            var name = property.Name;
            var value = previousValue;

            if (name == "Importer")
            {
                name = "ImporterName";
                value = ((ImporterTypeDescription)value).TypeName;
            }

            if (name == "Processor")
            {
                name = "ProcessorName";
                value = ((ProcessorTypeDescription)value).TypeName;
            }

            var field = _state.GetType().GetMember(name).SingleOrDefault() as FieldInfo;
            if (field == null)
            {
                if (!_state.ProcessorParams.ContainsKey(name))
                    throw new Exception();

                _state.ProcessorParams[name] = value;
            }
            else
            {
                field.SetValue(_state, value);
            }
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:35,代码来源:UpdateAction.cs

示例15: GetPath

        public PathData GetPath(ContentItem item, string remainingUrl)
        {
            int slashIndex = remainingUrl.IndexOf('/');

            string action = remainingUrl;
            string arguments = null;
            if(slashIndex > 0)
            {
                action = remainingUrl.Substring(0, slashIndex);
                arguments = remainingUrl.Substring(slashIndex + 1);
            }

            var controllerName = controllerMapper.GetControllerName(item.GetContentType());
            if (string.IsNullOrEmpty(action) || string.Equals(action, "Default.aspx", StringComparison.InvariantCultureIgnoreCase))
                action = "Index";

            foreach (string method in methods)
            {
                if (string.Equals(method, action, StringComparison.InvariantCultureIgnoreCase))
                {
                    return new PathData(item, null, action, arguments)
                    {
                        IsRewritable = false,
                        TemplateUrl = string.Format("~/{0}/{1}", controllerName, method, item.ID) // workaround for start pages
                    };
                }
            }

            return null;
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:30,代码来源:ActionResolver.cs


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