Exemple #1
0
 public static string CompositeFolderId(Folder folder)
 {
     if (folder is TextFolder)
     {
         return Content_Folder_Root + "$" + folder.FullName;
     }
     else
     {
         return Media_Folder_Root + "$" + folder.FullName;
     }
 }
Exemple #2
0
        public void TestCreateFolder()
        {
            var repositoryName = "FolderTests";
            var repository = new Repository(repositoryName);
            Folder folder1 = new Folder(repository, new[] { "folder1" });

            Assert.AreEqual("folder1", folder1.Name);

            Folder folder2 = new Folder(repository, new[] { "folder1", "folder2" });

            Assert.AreEqual("folder2", folder2.Name);
            Assert.AreEqual("folder1", folder2.Parent.Name);
        }
Exemple #3
0
        public FolderMenuItem(Folder folder)
        {
            base.Visible = true;
            base.Text = folder.Name;

            RouteValues = new System.Web.Routing.RouteValueDictionary();
            HtmlAttributes = new System.Web.Routing.RouteValueDictionary();

            RouteValues["repositoryName"] = folder.Repository.Name;
            RouteValues["FolderName"] = folder.FullName;

            //compatible with the Folder parameter changed to FolderName.
            RouteValues["Folder"] = folder.FullName;

            this.Area = "Contents";
            base.Text = folder.FriendlyText;
            var cssClass = "";
            if (folder is TextFolder)
            {
                if (string.IsNullOrEmpty(((TextFolder)folder).SchemaName))
                {
                    base.Controller = "TextFolder";
                    base.Action = "Index";
                }
                else
                {
                    base.Controller = "TextContent";
                    base.Action = "index";
                }
                cssClass = "TextFolder";
            }
            else if (folder is MediaFolder)
            {
                base.Controller = "MediaContent";
                base.Action = "index";

                cssClass = "TextFolder";
            }
            //Set folder class
            HtmlAttributes["Class"] = cssClass + " " + string.Join("-", folder.NamePaths.ToArray());

            this.Initializer = new FolderMenuItemInitializer();
        }
Exemple #4
0
        public virtual void Delete(Repository repository, Folder folder, string uuid)
        {
            var textFolder = (TextFolder)folder;

            textFolder = textFolder.AsActual();
            var textContent = textFolder.CreateQuery().WhereEquals("UUID", uuid).FirstOrDefault();
            if (textContent != null)
            {
                EventBus.Content.ContentEvent.Fire(ContentAction.PreDelete, textContent);

                TextContentProvider.Delete(textContent);

                EventBus.Content.ContentEvent.Fire(ContentAction.Delete, textContent);
            }
        }
Exemple #5
0
 public TextFolder(Repository repository, string name, Folder parent)
     : base(repository, name, parent)
 {
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Folder"/> class.
 /// </summary>
 /// <param name="repository">The repository.</param>
 /// <param name="name">The name.</param>
 /// <param name="parent">The parent.</param>
 public Folder(Repository repository, string name, Folder parent)
 {
     Repository = repository;
     this.Name = name;
     this.Parent = parent;
 }
Exemple #7
0
        private static CmisObject AddMediaFolder(Kooboo.CMS.Content.Models.Repository repository, Folder parent, System.Collections.Specialized.NameValueCollection values)
        {
            var mediaFolder = new MediaFolder(repository, values["name"], parent);
            mediaFolder.DisplayName = values["DisplayName"];
            var allowedExtensions = values["AllowedExtensions"];
            if (!string.IsNullOrEmpty(allowedExtensions))
            {
                mediaFolder.AllowedExtensions = allowedExtensions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            }

            var creationDate = values["UtcCreationDate"];
            if (!string.IsNullOrEmpty(creationDate))
            {
                mediaFolder.UtcCreationDate = DateTime.Parse(creationDate).ToUniversalTime();
            }

            ServiceFactory.MediaFolderManager.Add(repository, mediaFolder);

            return ObjectConvertor.ToCmis(mediaFolder, false);
        }
Exemple #8
0
        private static CmisObject AddContentFolder(Kooboo.CMS.Content.Models.Repository repository, Folder parent, System.Collections.Specialized.NameValueCollection values)
        {
            var textFolder = new TextFolder(repository, values["name"], parent);
            textFolder.DisplayName = values["DisplayName"];
            textFolder.SchemaName = values["schemaName"];
            var categories = values["CategoryFolders"];
            if (!string.IsNullOrEmpty(categories))
            {
                textFolder.CategoryFolders = categories.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            var creationDate = values["UtcCreationDate"];
            if (!string.IsNullOrEmpty(creationDate))
            {
                textFolder.UtcCreationDate = DateTime.Parse(creationDate).ToUniversalTime();
            }

            ServiceFactory.TextFolderManager.Add(repository, textFolder);

            return ObjectConvertor.ToCmis(textFolder, false);
        }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Folder"/> class.
 /// </summary>
 /// <param name="repository">The repository.</param>
 /// <param name="name">The name.</param>
 /// <param name="parent">The parent.</param>
 public Folder(Repository repository, string name, Folder parent)
 {
     Repository  = repository;
     this.Name   = name;
     this.Parent = parent;
 }