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


C# TextContent.GetFolder方法代码示例

本文整理汇总了C#中Kooboo.CMS.Content.Models.TextContent.GetFolder方法的典型用法代码示例。如果您正苦于以下问题:C# TextContent.GetFolder方法的具体用法?C# TextContent.GetFolder怎么用?C# TextContent.GetFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kooboo.CMS.Content.Models.TextContent的用法示例。


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

示例1: Copy

        public virtual ContentBase Copy(TextContent originalContent, TextFolder textFolder, bool keepStatus, bool keepUUID, NameValueCollection values)
        {
            textFolder = textFolder.AsActual();
            var repository = textFolder.Repository;
            var schema = new Schema(repository, textFolder.SchemaName);
            var copyedContent = new TextContent(originalContent);
            copyedContent.Id = "";
            copyedContent.UUID = "";
            if (keepUUID)
            {
                copyedContent.UUID = originalContent.UUID;
            }
            copyedContent.UtcCreationDate = DateTime.Now.ToUniversalTime();
            copyedContent.Repository = textFolder.Repository.Name;
            copyedContent.FolderName = textFolder.FullName;
            copyedContent.SchemaName = textFolder.SchemaName;
            copyedContent.OriginalUUID = originalContent.UUID;
            copyedContent.OriginalRepository = originalContent.Repository;
            copyedContent.OriginalFolder = originalContent.FolderName;
            copyedContent.IsLocalized = false;
            copyedContent.Sequence = 0;
            copyedContent.UserId = originalContent.UserId;

            var versions = Kooboo.CMS.Content.Versioning.VersionManager.AllVersionInfos(originalContent);
            if (versions.Count() > 0)
            {
                copyedContent.OriginalLastestVisitedVersionId = versions.Max(it => it.Version);
            }

            if (values != null)
            {
                originalContent = Binder.Bind(schema, copyedContent, values);
            }

            if (!keepStatus)
            {
                copyedContent.Published = false;
            }
            //如果没有Content event,那么在发送设置的“转发”功能就会失效。
            EventBus.Content.ContentEvent.Fire(ContentAction.PreAdd, copyedContent);

            TextContentProvider.Add(copyedContent);

            if (textFolder.Categories != null && textFolder.Categories.Count > 0)
            {
                var originalRepository = originalContent.GetRepository();
                var originalFolder = originalContent.GetFolder().AsActual();
                var originalCategories = QueryCategories(originalRepository, originalFolder.FullName, originalContent.UUID);

                List<TextContent> categories = new List<TextContent>();

                foreach (var category in originalCategories)
                {
                    foreach (var originalCategoryContent in category.Contents)
                    {
                        foreach (var categoryFolder in textFolder.Categories)
                        {
                            var categoryContent = (new TextFolder(textFolder.Repository, categoryFolder.FolderName)).CreateQuery()
                                .WhereEquals("UUID", originalCategoryContent.UUID).FirstOrDefault();
                            if (categoryContent != null)
                            {
                                categories.Add(categoryContent);
                                break;
                            }
                        }
                    }
                }

                AddCategories(repository, copyedContent, categories.ToArray());
            }

            EventBus.Content.ContentEvent.Fire(ContentAction.Add, copyedContent);

            return copyedContent;
        }
开发者ID:netcowboy,项目名称:CMS,代码行数:75,代码来源:TextContentManager.cs

示例2: EditItemAttributes

 public static IHtmlString EditItemAttributes(TextContent data)
 {
     var userName = Page_Context.Current.ControllerContext.HttpContext.User.Identity.Name;
     if (data == null || !Page_Context.Current.EnabledInlineEditing(EditingType.Content)
         || !Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToEditContent(data, userName))
     {
         return new HtmlString("");
     }
     var availableToPublish = Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToPublish(data.GetFolder(), userName);
     return new HtmlString(string.Format("editType=\"list\" schema=\"{0}\" folder=\"{1}\" title=\"{2}\" uuid=\"{3}\" published=\"{4}\" editUrl=\"{5}\" summary=\"{6}\" publishAvailable=\"{7}\"",
             data.SchemaName, data.FolderName, data.GetFolder().AsActual().FriendlyText, data.UUID, data.Published
         , Page_Context.Current.Url.Action("InlineEdit", new
         {
             controller = "TextContent",
             Area = "Contents",
             RepositoryName = data.Repository,
             SiteName = Page_Context.Current.PageRequestContext.Site.FullName,
             FolderName = data.FolderName,
             UUID = data.UUID,
             Return = Page_Context.Current.ControllerContext.HttpContext.Request.RawUrl
         }), HttpUtility.HtmlAttributeEncode(data.GetSummary())
         , availableToPublish));
 }
开发者ID:Godoy,项目名称:CMS,代码行数:23,代码来源:ViewHelper.cs


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